5 'libs/text!./stringField.html'
6 ], function($, _, Backbone, stringFieldTpl) {
11 string: _.template(stringFieldTpl)
14 var getAttrElement = function(attrName, attr) {
15 var toret = $('<div>');
16 toret.append(templates.string({name: attrName, value: attr.value}));
20 var MetaWidget = Backbone.View.extend({
22 'change [metaField-name]': 'onMetaFieldChange'
24 initialize: function() {
26 _.keys(this.options.attrs).forEach(function(attrName) {
27 view.$el.append(getAttrElement(attrName, this.options.attrs[attrName]));
30 onMetaFieldChange: function(e) {
31 var target = $(e.target);
32 this.trigger('valueChanged', target.attr('metaField-name'), target.val());
38 create: function(options) {
39 return new MetaWidget(options);