Roughing in measurements again

This commit is contained in:
Matthew Dillon 2015-06-05 15:48:15 -08:00
parent 6f50a381fc
commit 878e8d1b60
12 changed files with 127 additions and 20 deletions

View file

@ -13,6 +13,9 @@
{{#link-to 'characteristics' tagName='li' href=false}}
{{#link-to 'characteristics'}}Characteristics{{/link-to}}
{{/link-to}}
{{#link-to 'measurements' tagName='li' href=false}}
{{#link-to 'measurements'}}Measurements{{/link-to}}
{{/link-to}}
{{#link-to 'about' tagName='li' href=false}}
{{#link-to 'about'}}About{{/link-to}}
{{/link-to}}

View file

@ -0,0 +1,5 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'tr',
});

View file

@ -0,0 +1,11 @@
<td>
{{#link-to 'strains.show' data.strain.id}}
{{scientific-name strain=data.strain}}
{{/link-to}}
</td>
<td>
{{data.characteristic.characteristicName}}
</td>
<td>
{{{data.computedValue}}}
</td>

View file

@ -0,0 +1,21 @@
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function() {
return Ember.RSVP.hash({
measurements: this.store.findAll('measurement'),
species: this.store.findAll('species')
});
},
setupController: function(controller, models) {
var tableAttrs = [
{ name: 'Strain', attr: 'strain.strainName' },
{ name: 'Characteristic', attr: 'characteristic.CharacteristicName' },
{ name: 'Value', attr: 'computedValue'}
];
controller.set('model', models);
controller.set('tableAttrs', tableAttrs);
controller.set('row', 'measurement-index-row');
},
});

View file

@ -0,0 +1,11 @@
<h2>{{genus-name}} Measurements</h2>
<h3>Total measurements: {{model.length}}</h3>
{{
view "select"
content=model.species
optionValuePath="content.id"
optionLabelPath="content.speciesName"
}}
{{sortable-table content=model.measurements tableAttrs=tableAttrs row=row}}