More species-strain detail

This commit is contained in:
Matthew Dillon 2015-06-03 11:08:43 -08:00
parent f3aaa4739d
commit 7260b95937
8 changed files with 46 additions and 13 deletions

View file

@ -2,7 +2,10 @@ import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.store.createRecord('strain');
return Ember.RSVP.hash({
strain: this.store.createRecord('strain'),
species: this.store.findAll('species')
});
},
actions: {
cancelStrain: function() {

View file

@ -12,7 +12,22 @@
{{! ROW 1 }}
<div class="grid-4">
<dl class="span-4">
<dl class="span-2">
<dt>Strains</dt>
<dd>
{{#each strain in species.strains}}
{{#link-to 'strains.show' strain.id}}
{{strain.strainName}}
{{/link-to}}
{{/each}}
{{#if (can "edit species" species)}}
{{#link-to 'strains.new' class="button-gray smaller"}}
Add Strain
{{/link-to}}
{{/if}}
</dd>
</dl>
<dl class="span-2">
<dt>Type Species?</dt>
<dd>
{{#if isEditing}}
@ -57,7 +72,7 @@
</div>
{{! ROW 4 }}
{{#if (can "edit species" strain)}}
{{#if (can "edit species" species)}}
<div class="grid-4">
<div class="span-1">
{{! Does nothing ATM }}

View file

@ -24,7 +24,9 @@
selection=strain.species
}}
{{else}}
<em>{{strain.species.speciesName}}</em>
{{#link-to 'species.show' strain.species}}
<em>{{strain.species.speciesName}}</em>
{{/link-to}}
{{/if}}
</dd>
</dl>

View file

@ -23,7 +23,13 @@
{{species.speciesName}}
{{/link-to}}
</td>
<td>{{species.totalStrains}}</td>
<td>
{{#each strain in species.strains}}
{{#link-to 'strains.show' strain.id}}
{{strain.strainName}}
{{/link-to}}
{{/each}}
</td>
</tr>
{{/each}}
</tbody>

View file

@ -12,7 +12,7 @@
<thead>
<tr>
<th {{action "setSortBy" "fullName"}}>Name</th>
<th {{action "setSortBy" "totalMeasurements"}}>Measurements</th>
<th {{action "setSortBy" "totalMeasurements"}}>Total Measurements</th>
</tr>
</thead>
<tbody>

View file

@ -1 +1,8 @@
{{strains/strain-details strain=model isEditing=true isNew=true action="cancelStrain"}}
{{
strains/strain-details
strain=model.strain
species=model.species
isEditing=true
isNew=true
action="cancelStrain"
}}