protected route

This commit is contained in:
Matthew Dillon 2015-07-10 09:29:12 -08:00
parent 72c957f8dc
commit eb1a8bb6e3
41 changed files with 56 additions and 43 deletions

View file

@ -0,0 +1,11 @@
import Ember from 'ember';
export default Ember.Controller.extend({
sortParams: ['speciesName', 'strainCount'],
sortedSpecies: Ember.computed.sort('model', 'sortParams'),
metaData: function() {
return Ember.copy(this.store.metadataFor('species'));
}.property('model.isLoaded').readOnly(),
});

View file

@ -0,0 +1,7 @@
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.store.findAll('species');
}
});

View file

@ -0,0 +1,34 @@
<h2>{{genus-name}} Species</h2>
<h3>Total species: {{model.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>