diff --git a/app/adapters/species.js b/app/adapters/species.js new file mode 100644 index 0000000..2c5e29d --- /dev/null +++ b/app/adapters/species.js @@ -0,0 +1,5 @@ +import DS from 'ember-data'; + +export default DS.RESTAdapter.reopen({ + namespace: 'api' +}); diff --git a/app/models/genus.js b/app/models/genus.js index 7860531..48f6b7f 100644 --- a/app/models/genus.js +++ b/app/models/genus.js @@ -6,7 +6,8 @@ inflector.irregular('genus', 'genera'); export default DS.Model.extend({ genusName: DS.attr(), - createdAt: DS.attr(), - updatedAt: DS.attr(), - deletedAt: DS.attr() + species: DS.hasMany('species', {async: true}), + createdAt: DS.attr('date'), + updatedAt: DS.attr('date'), + deletedAt: DS.attr('date') }); diff --git a/app/models/species.js b/app/models/species.js new file mode 100644 index 0000000..cb11ed3 --- /dev/null +++ b/app/models/species.js @@ -0,0 +1,10 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + genusId: DS.attr(), + speciesName: DS.attr(), + genus: DS.belongsTo('genus', {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 3a9816c..a2be1c4 100644 --- a/app/router.js +++ b/app/router.js @@ -9,6 +9,7 @@ Router.map(function() { this.route('login'); this.route('about'); this.resource('genera'); + this.resource('species'); }); export default Router; diff --git a/app/routes/species.js b/app/routes/species.js new file mode 100644 index 0000000..aa33152 --- /dev/null +++ b/app/routes/species.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export default Ember.Route.extend({ + model: function() { + return this.store.find('species'); + } +}); diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 940c556..5a6ba9c 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -2,10 +2,13 @@
diff --git a/app/templates/genera.hbs b/app/templates/genera.hbs index 7fadb01..b3f4c38 100644 --- a/app/templates/genera.hbs +++ b/app/templates/genera.hbs @@ -1,7 +1,23 @@ -

Genera

+

This is here for debugging, this page will be deleted.

- +
diff --git a/app/templates/species.hbs b/app/templates/species.hbs new file mode 100644 index 0000000..ccfa3cb --- /dev/null +++ b/app/templates/species.hbs @@ -0,0 +1,29 @@ +
+ {{#each}} +
+
+ {{speciesName}} +
+
Genus
+
{{genus.genusName}}
+
+
+
Species
+
{{speciesName}}
+
+
+
Created
+
{{createdAt}}
+
+
+
Updated
+
{{updatedAt}}
+
+
+
Deleted
+
{{deletedAt}}
+
+
+
+ {{/each}} +