diff --git a/app/mirage/config.js b/app/mirage/config.js index a0fc750..48732c1 100644 --- a/app/mirage/config.js +++ b/app/mirage/config.js @@ -16,4 +16,8 @@ export function testConfig() { this.get('/species', function(db) { return { 'species': db.species }; }); + + this.get('/species/:id', function(db, request) { + return { 'species': db.species.find(request.params.id) }; + }); } diff --git a/app/mirage/factories/species.js b/app/mirage/factories/species.js index 814b3f2..9e8aa7f 100644 --- a/app/mirage/factories/species.js +++ b/app/mirage/factories/species.js @@ -1,11 +1,11 @@ import Mirage, { faker } from 'ember-cli-mirage'; export default Mirage.Factory.extend({ - speciesName: faker.lorem.words, - typeSpecies: faker.random.boolean, - etymology: faker.lorem.sentences, + speciesName() { return faker.lorem.words().join(' '); }, + typeSpecies: faker.random.boolean(), + etymology: faker.lorem.sentences(), genusName: 'hymenobacter', strains: [], totalStrains: 0, - sortOrder: faker.random.number, + sortOrder: faker.random.number(), }); diff --git a/app/pods/protected/species/show/controller.js b/app/pods/protected/species/show/controller.js index b44b6a7..684673b 100644 --- a/app/pods/protected/species/show/controller.js +++ b/app/pods/protected/species/show/controller.js @@ -1,6 +1,8 @@ import Ember from 'ember'; -export default Ember.Controller.extend({ +const { Controller } = Ember; + +export default Controller.extend({ actions: { delete: function() { this.get('model').destroyRecord().then(() => { diff --git a/app/pods/protected/species/show/route.js b/app/pods/protected/species/show/route.js index 94f8361..c99362f 100644 --- a/app/pods/protected/species/show/route.js +++ b/app/pods/protected/species/show/route.js @@ -1,8 +1,10 @@ import Ember from 'ember'; -export default Ember.Route.extend({ +const { Route } = Ember; + +export default Route.extend({ model: function(params) { - return this.store.findRecord('species', params.species_id, { reload: true }); + return this.store.findRecord('species', params.species_id); }, }); diff --git a/app/pods/protected/species/show/species-card/component.js b/app/pods/protected/species/show/species-card/component.js new file mode 100644 index 0000000..1492c0b --- /dev/null +++ b/app/pods/protected/species/show/species-card/component.js @@ -0,0 +1,14 @@ +import Ember from 'ember'; + +const { Component } = Ember; + +export default Component.extend({ + species: null, + "on-delete": null, + + actions: { + deleteSpecies: function() { + return this.attrs['on-delete'](); + }, + }, +}); diff --git a/app/pods/protected/species/show/species-card/template.hbs b/app/pods/protected/species/show/species-card/template.hbs new file mode 100644 index 0000000..fac8247 --- /dev/null +++ b/app/pods/protected/species/show/species-card/template.hbs @@ -0,0 +1,62 @@ +