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"
}}

View file

@ -9,7 +9,7 @@ module.exports = function(app) {
speciesName: "One",
typeSpecies: true,
etymology: "Test Etymology",
strains: [1],
strains: [1,2],
totalStrains: 1,
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
@ -24,7 +24,7 @@ module.exports = function(app) {
speciesName: "Two",
typeSpecies: true,
etymology: "Test Etymology",
strains: [2],
strains: [3],
totalStrains: 1,
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
@ -39,7 +39,7 @@ module.exports = function(app) {
speciesName: "Three",
typeSpecies: true,
etymology: "Test Etymology",
strains: [3],
strains: [4],
totalStrains: 1,
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",

View file

@ -23,7 +23,7 @@ module.exports = function(app) {
},
{
id: 2,
species: 2,
species: 1,
strainName: "XYZ",
typeStrain: false,
accessionNumbers: "Test Accession",
@ -41,7 +41,7 @@ module.exports = function(app) {
},
{
id: 3,
species: 3,
species: 2,
strainName: "QRS",
typeStrain: true,
accessionNumbers: "Test Accession",
@ -59,7 +59,7 @@ module.exports = function(app) {
},
{
id: 4,
species: 4,
species: 3,
strainName: "LMN",
typeStrain: true,
accessionNumbers: "Test Accession",