ES2015 first look / babeljs

This commit is contained in:
RainLoop Team 2015-11-15 03:23:16 +03:00
parent 5dcceaaca5
commit 445cd155e5
123 changed files with 3214 additions and 3680 deletions

30
dev/Component/SvgIcon.jsx Normal file
View file

@ -0,0 +1,30 @@
import {$} from 'common';
let
cachedUrl = null,
getUtl = () => {
if (!cachedUrl)
{
const version = $('#rlAppVersion').attr('content') || '0.0.0';
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
}
return cachedUrl;
}
;
module.exports = {
template: '<b></b>',
viewModel: {
createViewModel: (params, componentInfo) => {
if (componentInfo && componentInfo.element)
{
const icon = params.icon || 'null';
$(componentInfo.element).replaceWith(
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUtl()}#svg-icon-${icon}"></use></svg>`
);
}
}
}
};