string: _.template(stringFieldTpl)
};
-var getAttrElement = function(attr) {
+var getAttrElement = function(attrName, attr) {
var toret = $('<div>');
- toret.append(templates.string({name: attr.name, value: attr.value}));
+ toret.append(templates.string({name: attrName, value: attr.value}));
return toret;
};
},
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);
var dom = $('<div>');
var widget = metaWidget.create({
el: dom,
- attrs: [{name: 'uri', type: 'string', value: 'test string'}],
+ attrs: {'uri': {type: 'string', value: 'test string'}},
});
var spy = sinon.spy();
var widget = metaWidget.create({attrs:wlxmlNodeElement.getMetaAttributes()});
widget.on('valueChanged', function(key, value) {
- sandbox.publish('nodeElementChange', key, value);
+ wlxmlNodeElement.setMetaAttribute(key, value);
});
view.find('.metaFields').empty().append(widget.el);