diff --git a/src/trait_manager/view/TraitView.js b/src/trait_manager/view/TraitView.js index 1d3e972d9..35329178b 100644 --- a/src/trait_manager/view/TraitView.js +++ b/src/trait_manager/view/TraitView.js @@ -15,6 +15,7 @@ define(['backbone'], function (Backbone) { this.labelClass = this.ppfx + 'label'; this.fieldClass = this.ppfx + 'field'; this.inputhClass = this.ppfx + 'input-holder'; + this.model.off('change:value', this.onValueChange); this.listenTo(this.model, 'change:value', this.onValueChange); }, @@ -35,6 +36,7 @@ define(['backbone'], function (Backbone) { var trg = this.target; var attrs = trg.get('attributes'); attrs[m.get('name')] = m.get('value'); + trg.set('attributes', {}); trg.set('attributes', attrs); console.log(trg); }, @@ -54,7 +56,8 @@ define(['backbone'], function (Backbone) { */ getLabel: function() { var model = this.model; - return model.get('label') || model.get('name'); + var label = model.get('label') || model.get('name'); + return label.charAt(0).toUpperCase() + label.slice(1).replace(/-/g,' '); }, /** @@ -75,7 +78,8 @@ define(['backbone'], function (Backbone) { this.$el.append('
'); this.$input = $('', { placeholder: this.model.get('defaults'), - type: 'text' + type: 'text', + value: this.model.get('value') }); this.$el.find('.' + this.inputhClass).html(this.$input); } diff --git a/src/trait_manager/view/TraitsView.js b/src/trait_manager/view/TraitsView.js index 413480167..b624096a7 100644 --- a/src/trait_manager/view/TraitsView.js +++ b/src/trait_manager/view/TraitsView.js @@ -5,12 +5,11 @@ define(['backbone', 'Abstract/view/DomainViews', './TraitView'], itemView: TraitView, - className: 'test-traits', - initialize: function(o) { this.config = o.config || {}; this.em = o.editor; this.pfx = this.config.stylePrefix || ''; + this.className = this.pfx + 'traits'; this.listenTo(this.em, 'change:selectedComponent', this.updatedCollection); this.updatedCollection(); }, @@ -24,6 +23,7 @@ define(['backbone', 'Abstract/view/DomainViews', './TraitView'], if(comp){ this.collection = comp.get('traits'); this.render(); + this.el.className = this.className; } },