diff --git a/CHANGELOG.md b/CHANGELOG.md index 96ea0768..cca67f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/browser/js/app/parser.js b/browser/js/app/parser.js index fa49b6d4..acbdb52a 100644 --- a/browser/js/app/parser.js +++ b/browser/js/app/parser.js @@ -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 = $(`