From 658304f728c53878335c3292ce28185bacdeb19c Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 2 Dec 2015 10:42:59 -0700 Subject: [PATCH] Clean up no measurements on record --- .../strains/measurements-table/component.js | 6 +----- .../strains/measurements-table/template.hbs | 18 +++++++++--------- .../protected/strains/strain-form/component.js | 3 ++- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/pods/protected/strains/measurements-table/component.js b/app/pods/protected/strains/measurements-table/component.js index 49734f3..f9dac39 100644 --- a/app/pods/protected/strains/measurements-table/component.js +++ b/app/pods/protected/strains/measurements-table/component.js @@ -20,14 +20,10 @@ export default Component.extend({ sortAsc: true, paramsChanged: false, sortedMeasurements: sort('measurements', 'sortParams'), - measurementsPresent: computed('measurements', function() { - return this.get('measurements.length') > 0; - }), actions: { addCharacteristic: function() { - const measurement = this.attrs['add-characteristic'](); - this.get('measurements').addObject(measurement); + return this.attrs['add-characteristic'](); }, changeSortParam: function(col) { diff --git a/app/pods/protected/strains/measurements-table/template.hbs b/app/pods/protected/strains/measurements-table/template.hbs index 9e22393..d2d10dd 100644 --- a/app/pods/protected/strains/measurements-table/template.hbs +++ b/app/pods/protected/strains/measurements-table/template.hbs @@ -6,12 +6,11 @@

{{/if}} -{{#if measurementsPresent}} - {{#if paramsChanged}} - - {{/if}} +{{#if paramsChanged}} + +{{/if}} {{#if canEdit}} @@ -48,9 +47,10 @@ allCharacteristics=allCharacteristics canEdit=canEdit }} + {{else}} + + + {{/each}}
No Measurements on Record
-{{else}} -No measurements on record. -{{/if}} diff --git a/app/pods/protected/strains/strain-form/component.js b/app/pods/protected/strains/strain-form/component.js index 9090500..f761a04 100644 --- a/app/pods/protected/strains/strain-form/component.js +++ b/app/pods/protected/strains/strain-form/component.js @@ -104,7 +104,8 @@ export default Component.extend(SetupMetaData, { }, addCharacteristic: function() { - return this.attrs['add-characteristic'](); + const measurement = this.attrs['add-characteristic'](); + this.get('measurements').pushObject(measurement); }, saveMeasurement: function(measurement, properties) {