5 'libs/text!./stringField.html'
6 ], function($, _, Backbone, stringFieldTpl) {
11 string: _.template(stringFieldTpl)
14 var getAttrElement = function(attr) {
15 var toret = $('<div>');
16 toret.append(templates.string({name: attr.name, value: attr.value}));
20 var MetaWidget = Backbone.View.extend({
22 'change [metaField-name]': 'onMetaFieldChange'
24 initialize: function() {
26 this.options.attrs.forEach(function(attr) {
27 view.$el.append(getAttrElement(attr));
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);