Refactor strains/index

This commit is contained in:
Matthew Dillon 2015-11-10 11:13:22 -07:00
parent 35475c2b92
commit 85d861da27
6 changed files with 46 additions and 42 deletions

View file

@ -0,0 +1,12 @@
import Ember from 'ember';
import SetupMetaData from '../../../../../mixins/setup-metadata';
const { Component, computed: { sort } } = Ember;
export default Component.extend(SetupMetaData, {
strains: null,
sortParams: ['fullNameMU'],
sortedStrains: sort('strains', 'sortParams'),
});

View file

@ -0,0 +1,26 @@
<h3 id="total-strains">Total strains: {{strains.length}}</h3>
{{add-button label="Add Strain" link="protected.strains.new" canAdd=metaData.canAdd}}
<table class="flakes-table">
<thead>
<tr>
<th>Species</th>
<th>Total Measurements</th>
</tr>
</thead>
<tbody>
{{#each sortedStrains as |strain|}}
<tr>
<td>
{{#link-to 'protected.strains.show' strain classBinding="data.typeStrain:type-strain"}}
{{strain.fullNameMU}}
{{/link-to}}
</td>
<td>
{{strain.totalMeasurements}}
</td>
</tr>
{{/each}}
</tbody>
</table>