From 8b4a26a932866ded309c89d63132db0a6ab54fff Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 17 Nov 2015 16:10:33 -0700 Subject: [PATCH] Detailed characteristics view --- .../show/measurements-table/component.js | 9 ++++----- .../show/measurements-table/template.hbs | 10 +++++----- app/pods/protected/characteristics/show/route.js | 2 +- app/pods/protected/species/show/route.js | 2 +- app/pods/protected/strains/show/route.js | 2 +- app/pods/protected/users/show/route.js | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/pods/protected/characteristics/show/measurements-table/component.js b/app/pods/protected/characteristics/show/measurements-table/component.js index 96b79fc..e1d47d2 100644 --- a/app/pods/protected/characteristics/show/measurements-table/component.js +++ b/app/pods/protected/characteristics/show/measurements-table/component.js @@ -1,7 +1,7 @@ import Ember from 'ember'; const { Component, computed } = Ember; -const { sort } = computed; +const { alias, sort } = computed; export default Component.extend({ characteristic: null, @@ -10,10 +10,9 @@ export default Component.extend({ return this.get('characteristic.measurements.length') > 0; }), - sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'], - sortAsc: true, - paramsChanged: false, - sortedMeasurements: sort('characteristic.measurements', 'sortParams'), + measurements: alias('characteristic.measurements'), + sortParams: ['strain.sortOrder'], + sortedMeasurements: sort('measurements', 'sortParams'), actions: { changeSortParam: function(col) { diff --git a/app/pods/protected/characteristics/show/measurements-table/template.hbs b/app/pods/protected/characteristics/show/measurements-table/template.hbs index 8c7e2cb..d260cfc 100644 --- a/app/pods/protected/characteristics/show/measurements-table/template.hbs +++ b/app/pods/protected/characteristics/show/measurements-table/template.hbs @@ -13,18 +13,18 @@ - {{#each sortedMeasurements as |row|}} + {{#each sortedMeasurements as |measurement|}} - {{#link-to 'protected.strains.show' row.strain.id}} - {{strain-name strain=row.strain}} + {{#link-to 'protected.strains.show' measurement.strain.id classBinding="measurement.strain.typeStrain:type-strain"}} + {{measurement.strain.fullNameMU}} {{/link-to}} - {{row.value}} + {{measurement.value}} - {{row.notes}} + {{measurement.notes}} {{/each}} diff --git a/app/pods/protected/characteristics/show/route.js b/app/pods/protected/characteristics/show/route.js index 0f50705..d6394ce 100644 --- a/app/pods/protected/characteristics/show/route.js +++ b/app/pods/protected/characteristics/show/route.js @@ -4,7 +4,7 @@ const { Route } = Ember; export default Route.extend({ model: function(params) { - return this.store.findRecord('characteristic', params.characteristic_id); + return this.store.findRecord('characteristic', params.characteristic_id, { reload: true }); }, }); diff --git a/app/pods/protected/species/show/route.js b/app/pods/protected/species/show/route.js index c99362f..ac07e8f 100644 --- a/app/pods/protected/species/show/route.js +++ b/app/pods/protected/species/show/route.js @@ -4,7 +4,7 @@ const { Route } = Ember; export default Route.extend({ model: function(params) { - return this.store.findRecord('species', params.species_id); + return this.store.findRecord('species', params.species_id, { reload: true }); }, }); diff --git a/app/pods/protected/strains/show/route.js b/app/pods/protected/strains/show/route.js index ea320bd..20008bb 100644 --- a/app/pods/protected/strains/show/route.js +++ b/app/pods/protected/strains/show/route.js @@ -4,7 +4,7 @@ const { Route } = Ember; export default Route.extend({ model: function(params) { - return this.store.findRecord('strain', params.strain_id); + return this.store.findRecord('strain', params.strain_id, { reload: true }); }, }); diff --git a/app/pods/protected/users/show/route.js b/app/pods/protected/users/show/route.js index fe3c12c..1097d58 100644 --- a/app/pods/protected/users/show/route.js +++ b/app/pods/protected/users/show/route.js @@ -21,7 +21,7 @@ export default Route.extend({ }, model: function(params) { - return this.store.findRecord('user', params.user_id); + return this.store.findRecord('user', params.user_id, { reload: true }); }, });