New index
This commit is contained in:
parent
6dbdd70d31
commit
a52710f090
5 changed files with 54 additions and 47 deletions
17
app/pods/protected/species/index/species-table/component.js
Normal file
17
app/pods/protected/species/index/species-table/component.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
currentUser: Ember.inject.service('session-account'),
|
||||
|
||||
metaData: null,
|
||||
|
||||
setupMetaDataOnInit: Ember.on('init', function() {
|
||||
this.get('currentUser.account').then((user) => {
|
||||
this.set('metaData', user.get('metaData'));
|
||||
});
|
||||
}),
|
||||
|
||||
sortParams: ['speciesName', 'strainCount'],
|
||||
sortedSpecies: Ember.computed.sort('species', 'sortParams'),
|
||||
|
||||
});
|
33
app/pods/protected/species/index/species-table/template.hbs
Normal file
33
app/pods/protected/species/index/species-table/template.hbs
Normal file
|
@ -0,0 +1,33 @@
|
|||
<h3>Total species: {{species.length}}</h3>
|
||||
|
||||
{{add-button label="Add Species" link="protected.species.new" canAdd=metaData.canAdd}}
|
||||
|
||||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Strains</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each sortedSpecies as |species|}}
|
||||
<tr>
|
||||
<td>
|
||||
<em>
|
||||
{{#link-to 'protected.species.show' species}}
|
||||
{{species.speciesName}}
|
||||
{{/link-to}}
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
{{#each species.strains as |strain index|}}
|
||||
{{if index ","}}
|
||||
{{#link-to 'protected.strains.show' strain.id}}
|
||||
{{{strain.strainNameMU}}}
|
||||
{{/link-to}}
|
||||
{{/each}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
Reference in a new issue