add icon support in label

This commit is contained in:
bordun 2016-06-07 15:16:49 +02:00
parent 794fa01319
commit fe10029b8f
3 changed files with 16 additions and 5 deletions

View file

@ -10,6 +10,7 @@
- Faders & Meters design improved
- misc
- Fader's `align` option replaced with boolean option `alignRight`
- Widget's `label` now accepts special directive `icon: fontawesome-class` to display icons from [FontAwesome](http://fontawesome.io/icons/)
## 0.5.4

View file

@ -1,6 +1,7 @@
var widgets = require('./widgets'),
widgetOptions = widgets.widgetOptions,
createWidget = widgets.createWidget
createWidget = widgets.createWidget,
icon = require('./utils').icon
var getIterator = function(id,type){
var iterator = MISC.iterators[type]
@ -135,7 +136,11 @@ module.exports.widgets = function(data,parent) {
styleL = widgetData.left&&widgetData.left!='auto'||widgetData.left==0?`left:${left};`:'',
styleT = widgetData.top&&widgetData.top!='auto'||widgetData.top==0?`top:${top};`:''
var label = widgetData.label == 'auto'?widgetData.id:widgetData.label
var label = widgetData.label == 'auto'?
widgetData.id:
typeof widgetData.label == 'string' && widgetData.label.indexOf('icon:')!=-1?
icon(widgetData.label.split(':')[1].trim()):
widgetData.label
var widgetContainer = $(`
<div class="widget ${widgetData.type}-container ${styleL.length || styleT.length?'absolute-position':''}" style="${styleW + styleH + styleL + styleT + widgetData.css}">

View file

@ -1182,7 +1182,8 @@ module.exports = function(session,callback) {
},{"./actions":2,"./editor/init":7,"./parser":10,"./ui":12,"./widgets":14}],10:[function(require,module,exports){
var widgets = require('./widgets'),
widgetOptions = widgets.widgetOptions,
createWidget = widgets.createWidget
createWidget = widgets.createWidget,
icon = require('./utils').icon
var getIterator = function(id,type){
var iterator = MISC.iterators[type]
@ -1317,7 +1318,11 @@ module.exports.widgets = function(data,parent) {
styleL = widgetData.left&&widgetData.left!='auto'||widgetData.left==0?`left:${left};`:'',
styleT = widgetData.top&&widgetData.top!='auto'||widgetData.top==0?`top:${top};`:''
var label = widgetData.label == 'auto'?widgetData.id:widgetData.label
var label = widgetData.label == 'auto'?
widgetData.id:
typeof widgetData.label == 'string' && widgetData.label.indexOf('icon:')!=-1?
icon(widgetData.label.split(':')[1].trim()):
widgetData.label
var widgetContainer = $(`
<div class="widget ${widgetData.type}-container ${styleL.length || styleT.length?'absolute-position':''}" style="${styleW + styleH + styleL + styleT + widgetData.css}">
@ -1360,7 +1365,7 @@ module.exports.widgets = function(data,parent) {
}
},{"./widgets":14}],11:[function(require,module,exports){
},{"./utils":13,"./widgets":14}],11:[function(require,module,exports){
var actions = require('./actions'),
icon = require('./utils').icon