Add characteristic/measurement to strain
This commit is contained in:
parent
34aa59caf3
commit
da27b42f76
6 changed files with 25 additions and 1 deletions
|
@ -11,7 +11,19 @@ export default Ember.Component.extend({
|
|||
}
|
||||
}.on('didInsertElement'),
|
||||
|
||||
sortParams: ['characteristicTypeName', 'sortOrder', 'characteristicName'],
|
||||
sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'],
|
||||
sortedMeasurements: Ember.computed.sort('model.measurements', 'sortParams'),
|
||||
|
||||
actions: {
|
||||
addCharacteristic: function() {
|
||||
const c = this.store.createRecord('characteristic', {
|
||||
sortOrder: -999
|
||||
})
|
||||
const m = this.store.createRecord('measurement', {
|
||||
characteristic: c
|
||||
});
|
||||
this.get('model.measurements').addObject(m);
|
||||
},
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
{{#if canAdd}}
|
||||
<br>
|
||||
<button class="button-green smaller" {{action "addCharacteristic"}}>
|
||||
Add characteristic
|
||||
</button>
|
||||
<br><br>
|
||||
{{/if}}
|
||||
|
||||
{{#if measurementsPresent}}
|
||||
<table class="flakes-table">
|
||||
<colgroup>
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
protected/strains/show/measurements-table
|
||||
model=model
|
||||
canEdit=false
|
||||
canAdd=false
|
||||
}}
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
Reference in a new issue