From 1a59456ae951d2f6f1a2bbaa735a8ffae29adaad Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 26 Jan 2015 09:50:34 -0900 Subject: [PATCH] Rough in strains. --- app/models/species.js | 2 +- app/models/strain.js | 14 +++++++++ app/router.js | 1 + app/routes/strains.js | 7 +++++ app/templates/application.hbs | 3 ++ app/templates/species.hbs | 12 ++++++++ app/templates/strains.hbs | 53 +++++++++++++++++++++++++++++++++++ 7 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 app/models/strain.js create mode 100644 app/routes/strains.js create mode 100644 app/templates/strains.hbs diff --git a/app/models/species.js b/app/models/species.js index cb11ed3..ec1a9fd 100644 --- a/app/models/species.js +++ b/app/models/species.js @@ -1,9 +1,9 @@ import DS from 'ember-data'; export default DS.Model.extend({ - genusId: DS.attr(), speciesName: DS.attr(), genus: DS.belongsTo('genus', {async: true}), + strains: DS.hasMany('strain', {async: true}), createdAt: DS.attr('date'), updatedAt: DS.attr('date'), deletedAt: DS.attr('date') diff --git a/app/models/strain.js b/app/models/strain.js new file mode 100644 index 0000000..8f623d7 --- /dev/null +++ b/app/models/strain.js @@ -0,0 +1,14 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + strainName: DS.attr(), + strainType: DS.attr(), + etymology: DS.attr(), + accessionBanks: DS.attr(), + genbankEmblDdb: DS.attr(), + isolatedFrom: DS.attr(), + species: DS.belongsTo('species', {async: true}), + createdAt: DS.attr('date'), + updatedAt: DS.attr('date'), + deletedAt: DS.attr('date') +}); diff --git a/app/router.js b/app/router.js index a2be1c4..8b76a92 100644 --- a/app/router.js +++ b/app/router.js @@ -10,6 +10,7 @@ Router.map(function() { this.route('about'); this.resource('genera'); this.resource('species'); + this.resource('strains'); }); export default Router; diff --git a/app/routes/strains.js b/app/routes/strains.js new file mode 100644 index 0000000..ce81372 --- /dev/null +++ b/app/routes/strains.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function() { + return this.store.find('strain'); + } +}); diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 5a6ba9c..93ba94c 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -7,6 +7,9 @@ {{#link-to 'species' tagName='li' href=false}} {{#link-to 'species'}}Species{{/link-to}} {{/link-to}} + {{#link-to 'strains' tagName='li' href=false}} + {{#link-to 'strains'}}Strains{{/link-to}} + {{/link-to}} {{#link-to 'about' tagName='li' href=false}} {{#link-to 'about'}}About{{/link-to}} {{/link-to}} diff --git a/app/templates/species.hbs b/app/templates/species.hbs index ccfa3cb..964149d 100644 --- a/app/templates/species.hbs +++ b/app/templates/species.hbs @@ -3,6 +3,10 @@
{{speciesName}} +
+
Id
+
{{id}}
+
Genus
{{genus.genusName}}
@@ -11,6 +15,14 @@
Species
{{speciesName}}
+
+
Strains
+
+ {{#each strains}} + {{strainName}} + {{/each}} +
+
Created
{{createdAt}}
diff --git a/app/templates/strains.hbs b/app/templates/strains.hbs new file mode 100644 index 0000000..f180b3d --- /dev/null +++ b/app/templates/strains.hbs @@ -0,0 +1,53 @@ +
+ {{#each}} +
+
+ {{strainName}} +
+
Id
+
{{id}}
+
+
+
Species
+
{{species.speciesName}}
+
+
+
Strain
+
{{strainName}}
+
+
+
Type
+
{{strainType}}
+
+
+
Etymology
+
{{etymology}}
+
+
+
Accession Banks
+
{{accessionBanks}}
+
+
+
Genbank EMBL DDB
+
{{genbankEmblDdb}}
+
+
+
Isolated From
+
{{isolatedFrom}}
+
+
+
Created
+
{{createdAt}}
+
+
+
Updated
+
{{updatedAt}}
+
+
+
Deleted
+
{{deletedAt}}
+
+
+
+ {{/each}} +