diff --git a/app/routes/strains/new.js b/app/routes/strains/new.js index 3fa1c56..6524edc 100644 --- a/app/routes/strains/new.js +++ b/app/routes/strains/new.js @@ -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() { diff --git a/app/templates/components/species/species-details.hbs b/app/templates/components/species/species-details.hbs index ce628a8..aee7091 100644 --- a/app/templates/components/species/species-details.hbs +++ b/app/templates/components/species/species-details.hbs @@ -12,7 +12,22 @@ {{! ROW 1 }}
-
+
+
Strains
+
+ {{#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}} +
+
+
Type Species?
{{#if isEditing}} @@ -57,7 +72,7 @@
{{! ROW 4 }} - {{#if (can "edit species" strain)}} + {{#if (can "edit species" species)}}
{{! Does nothing ATM }} diff --git a/app/templates/components/strains/strain-details.hbs b/app/templates/components/strains/strain-details.hbs index 32d674e..ccb8f17 100644 --- a/app/templates/components/strains/strain-details.hbs +++ b/app/templates/components/strains/strain-details.hbs @@ -24,7 +24,9 @@ selection=strain.species }} {{else}} - {{strain.species.speciesName}} + {{#link-to 'species.show' strain.species}} + {{strain.species.speciesName}} + {{/link-to}} {{/if}} diff --git a/app/templates/species/index.hbs b/app/templates/species/index.hbs index bafa0e8..c2b3d8a 100644 --- a/app/templates/species/index.hbs +++ b/app/templates/species/index.hbs @@ -23,7 +23,13 @@ {{species.speciesName}} {{/link-to}} - {{species.totalStrains}} + + {{#each strain in species.strains}} + {{#link-to 'strains.show' strain.id}} + {{strain.strainName}} + {{/link-to}} + {{/each}} + {{/each}} diff --git a/app/templates/strains/index.hbs b/app/templates/strains/index.hbs index 0610774..7b8ddf3 100644 --- a/app/templates/strains/index.hbs +++ b/app/templates/strains/index.hbs @@ -12,7 +12,7 @@ Name - Measurements + Total Measurements diff --git a/app/templates/strains/new.hbs b/app/templates/strains/new.hbs index bca2106..5af443b 100644 --- a/app/templates/strains/new.hbs +++ b/app/templates/strains/new.hbs @@ -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" +}} diff --git a/server/mocks/species.js b/server/mocks/species.js index af29aac..3a3ca44 100644 --- a/server/mocks/species.js +++ b/server/mocks/species.js @@ -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", diff --git a/server/mocks/strains.js b/server/mocks/strains.js index c316b57..1d39993 100644 --- a/server/mocks/strains.js +++ b/server/mocks/strains.js @@ -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",