Detailed characteristics view

This commit is contained in:
Matthew Dillon 2015-11-17 16:10:33 -07:00
parent e33852120a
commit 8b4a26a932
6 changed files with 13 additions and 14 deletions

View file

@ -1,7 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
const { Component, computed } = Ember; const { Component, computed } = Ember;
const { sort } = computed; const { alias, sort } = computed;
export default Component.extend({ export default Component.extend({
characteristic: null, characteristic: null,
@ -10,10 +10,9 @@ export default Component.extend({
return this.get('characteristic.measurements.length') > 0; return this.get('characteristic.measurements.length') > 0;
}), }),
sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'], measurements: alias('characteristic.measurements'),
sortAsc: true, sortParams: ['strain.sortOrder'],
paramsChanged: false, sortedMeasurements: sort('measurements', 'sortParams'),
sortedMeasurements: sort('characteristic.measurements', 'sortParams'),
actions: { actions: {
changeSortParam: function(col) { changeSortParam: function(col) {

View file

@ -13,18 +13,18 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each sortedMeasurements as |row|}} {{#each sortedMeasurements as |measurement|}}
<tr> <tr>
<td> <td>
{{#link-to 'protected.strains.show' row.strain.id}} {{#link-to 'protected.strains.show' measurement.strain.id classBinding="measurement.strain.typeStrain:type-strain"}}
{{strain-name strain=row.strain}} {{measurement.strain.fullNameMU}}
{{/link-to}} {{/link-to}}
</td> </td>
<td> <td>
{{row.value}} {{measurement.value}}
</td> </td>
<td> <td>
{{row.notes}} {{measurement.notes}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}

View file

@ -4,7 +4,7 @@ const { Route } = Ember;
export default Route.extend({ export default Route.extend({
model: function(params) { model: function(params) {
return this.store.findRecord('characteristic', params.characteristic_id); return this.store.findRecord('characteristic', params.characteristic_id, { reload: true });
}, },
}); });

View file

@ -4,7 +4,7 @@ const { Route } = Ember;
export default Route.extend({ export default Route.extend({
model: function(params) { model: function(params) {
return this.store.findRecord('species', params.species_id); return this.store.findRecord('species', params.species_id, { reload: true });
}, },
}); });

View file

@ -4,7 +4,7 @@ const { Route } = Ember;
export default Route.extend({ export default Route.extend({
model: function(params) { model: function(params) {
return this.store.findRecord('strain', params.strain_id); return this.store.findRecord('strain', params.strain_id, { reload: true });
}, },
}); });

View file

@ -21,7 +21,7 @@ export default Route.extend({
}, },
model: function(params) { model: function(params) {
return this.store.findRecord('user', params.user_id); return this.store.findRecord('user', params.user_id, { reload: true });
}, },
}); });