X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/efe36f4f1b5df351eeb4d40a54c3900cf9a7079b..732705c82a02743c942fd792e5b4438b045cf9f1:/src/editor/modules/nodePane/metaWidget/metaWidget.js?ds=sidebyside diff --git a/src/editor/modules/nodePane/metaWidget/metaWidget.js b/src/editor/modules/nodePane/metaWidget/metaWidget.js index 14ba7b6..6f9b34c 100644 --- a/src/editor/modules/nodePane/metaWidget/metaWidget.js +++ b/src/editor/modules/nodePane/metaWidget/metaWidget.js @@ -11,21 +11,21 @@ var templates = { string: _.template(stringFieldTpl) }; -var getAttrElement = function(attr) { - var toret = $('
'); - toret.append(templates.string({name: attr.name, value: attr.value})); +var getAttrElement = function(attrName, attr) { + var toret = $('
'); + toret.append(templates.string({name: attrName, value: attr.value})); return toret; }; var MetaWidget = Backbone.View.extend({ events: { - 'change [metaField-name]': 'onMetaFieldChange' + 'change [metaField-name]': 'onMetaFieldChange' }, initialize: function() { var view = this; - this.options.attrs.forEach(function(attr) { - view.$el.append(getAttrElement(attr)); - }); + _.keys(this.options.attrs).forEach(function(attrName) { + view.$el.append(getAttrElement(attrName, this.options.attrs[attrName])); + }.bind(this)); }, onMetaFieldChange: function(e) { var target = $(e.target);