Characteristics details

This commit is contained in:
Matthew Dillon 2015-09-08 06:31:57 -07:00
parent ceccf6e536
commit fb296340c3
9 changed files with 48 additions and 53 deletions

View file

@ -1,28 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'tr',
actions: {
edit: function() {
this.set('characteristicName', this.get('row.characteristicName'));
this.set('characteristicTypeName', this.get('row.characteristicTypeName'));
this.set('sortOrder', this.get('row.sortOrder'));
this.toggleProperty('isEditing');
},
save: function() {
if (this.get('characteristicName') !== this.get('row.characteristicName') ||
this.get('characteristicTypeName') !== this.get('row.characteristicTypeName') ||
this.get('sortOrder') !== this.get('row.sortOrder')) {
this.set('row.characteristicName', this.get('characteristicName'));
this.set('row.characteristicTypeName', this.get('characteristicTypeName'));
this.set('row.sortOrder', this.get('sortOrder'));
this.get('row').save();
}
this.toggleProperty('isEditing');
},
}
});

View file

@ -1,15 +0,0 @@
{{#if isEditing}}
<td>{{input value=characteristicName}}</td>
<td>{{input value=characteristicTypeName}}</td>
<td>{{input value=sortOrder}}</td>
<td {{action 'save'}}>Save</td>
{{else}}
<td>{{row.characteristicName}}</td>
<td>{{row.characteristicTypeName}}</td>
<td>{{row.sortOrder}}</td>
{{#if row.canEdit}}
<td {{action 'edit'}}>Edit</td>
{{else}}
<td></td>
{{/if}}
{{/if}}