protected route
This commit is contained in:
parent
72c957f8dc
commit
eb1a8bb6e3
41 changed files with 56 additions and 43 deletions
11
app/pods/protected/species/index/controller.js
Normal file
11
app/pods/protected/species/index/controller.js
Normal 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(),
|
||||
|
||||
});
|
7
app/pods/protected/species/index/route.js
Normal file
7
app/pods/protected/species/index/route.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function() {
|
||||
return this.store.findAll('species');
|
||||
}
|
||||
});
|
34
app/pods/protected/species/index/template.hbs
Normal file
34
app/pods/protected/species/index/template.hbs
Normal 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>
|
Reference in a new issue