diff --git a/app/pods/protected/strains/show/controller.js b/app/pods/protected/strains/show/controller.js index 7128b9a..e5e3e77 100644 --- a/app/pods/protected/strains/show/controller.js +++ b/app/pods/protected/strains/show/controller.js @@ -1,12 +1,9 @@ import Ember from 'ember'; +import DeleteModel from '../../../../mixins/delete-model'; -export default Ember.Controller.extend({ - actions: { - delete: function() { - this.get('model').destroyRecord().then(() => { - this.transitionToRoute('protected.strains.index'); - }); - }, - }, +const { Controller } = Ember; +export default Controller.extend(DeleteModel, { + // Required for DeleteModel mixin + transitionRoute: 'protected.strains.index', }); diff --git a/app/pods/protected/strains/show/measurements-table-row/component.js b/app/pods/protected/strains/show/measurements-table-row/component.js index b4220cd..8ad1ba7 100644 --- a/app/pods/protected/strains/show/measurements-table-row/component.js +++ b/app/pods/protected/strains/show/measurements-table-row/component.js @@ -1,7 +1,9 @@ import Ember from 'ember'; import ajaxError from '../../../../../utils/ajax-error'; -export default Ember.Component.extend({ +const { Component } = Ember; + +export default Component.extend({ tagName: 'tr', isEditing: false, diff --git a/app/pods/protected/strains/show/measurements-table/component.js b/app/pods/protected/strains/show/measurements-table/component.js index 07d94c6..6cbf880 100644 --- a/app/pods/protected/strains/show/measurements-table/component.js +++ b/app/pods/protected/strains/show/measurements-table/component.js @@ -1,6 +1,8 @@ import Ember from 'ember'; -export default Ember.Component.extend({ +const { Component } = Ember; + +export default Component.extend({ measurementsPresent: function() { return this.get('model.measurements.length') > 0; }.property('model.measurements'), diff --git a/app/pods/protected/strains/show/route.js b/app/pods/protected/strains/show/route.js index 0a17d8b..ea320bd 100644 --- a/app/pods/protected/strains/show/route.js +++ b/app/pods/protected/strains/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('strain', params.strain_id, { reload: true }); + return this.store.findRecord('strain', params.strain_id); }, }); diff --git a/app/pods/protected/strains/show/strain-card/component.js b/app/pods/protected/strains/show/strain-card/component.js new file mode 100644 index 0000000..40802c8 --- /dev/null +++ b/app/pods/protected/strains/show/strain-card/component.js @@ -0,0 +1,14 @@ +import Ember from 'ember'; + +const { Component } = Ember; + +export default Component.extend({ + strain: null, + "on-delete": null, + + actions: { + deleteStrain: function() { + return this.attrs['on-delete'](); + }, + }, +}); diff --git a/app/pods/protected/strains/show/strain-card/template.hbs b/app/pods/protected/strains/show/strain-card/template.hbs new file mode 100644 index 0000000..989db71 --- /dev/null +++ b/app/pods/protected/strains/show/strain-card/template.hbs @@ -0,0 +1,105 @@ +