diff --git a/app/pods/protected/species/index/species-table/component.js b/app/pods/protected/species/index/species-table/component.js index d58f509..528c48d 100644 --- a/app/pods/protected/species/index/species-table/component.js +++ b/app/pods/protected/species/index/species-table/component.js @@ -1,12 +1,12 @@ import Ember from 'ember'; import SetupMetaData from '../../../../../mixins/setup-metadata'; -const { Component } = Ember; +const { Component, computed: { sort } } = Ember; export default Component.extend(SetupMetaData, { species: null, sortParams: ['speciesName', 'strainCount'], - sortedSpecies: Ember.computed.sort('species', 'sortParams'), + sortedSpecies: sort('species', 'sortParams'), }); diff --git a/app/pods/protected/strains/index/controller.js b/app/pods/protected/strains/index/controller.js deleted file mode 100644 index ec348db..0000000 --- a/app/pods/protected/strains/index/controller.js +++ /dev/null @@ -1,6 +0,0 @@ -import Ember from 'ember'; - -export default Ember.Controller.extend({ - sortParams: ['sortOrder'], - sortedStrains: Ember.computed.sort('model', 'sortParams'), -}); diff --git a/app/pods/protected/strains/index/route.js b/app/pods/protected/strains/index/route.js index e5582d7..627760f 100644 --- a/app/pods/protected/strains/index/route.js +++ b/app/pods/protected/strains/index/route.js @@ -1,17 +1,10 @@ import Ember from 'ember'; -export default Ember.Route.extend({ - currentUser: Ember.inject.service('session-account'), +const { Route } = Ember; +export default Route.extend({ model: function() { return this.store.findAll('strain'); }, - setupController: function(controller, model) { - controller.set('model', model); - this.get('currentUser.account').then((user) => { - controller.set('metaData', user.get('metaData')); - }); - }, - }); diff --git a/app/pods/protected/strains/index/strain-table/component.js b/app/pods/protected/strains/index/strain-table/component.js new file mode 100644 index 0000000..0e801ca --- /dev/null +++ b/app/pods/protected/strains/index/strain-table/component.js @@ -0,0 +1,12 @@ +import Ember from 'ember'; +import SetupMetaData from '../../../../../mixins/setup-metadata'; + +const { Component, computed: { sort } } = Ember; + +export default Component.extend(SetupMetaData, { + strains: null, + + sortParams: ['fullNameMU'], + sortedStrains: sort('strains', 'sortParams'), + +}); diff --git a/app/pods/protected/strains/index/strain-table/template.hbs b/app/pods/protected/strains/index/strain-table/template.hbs new file mode 100644 index 0000000..bb13d76 --- /dev/null +++ b/app/pods/protected/strains/index/strain-table/template.hbs @@ -0,0 +1,26 @@ +

Total strains: {{strains.length}}

+ +{{add-button label="Add Strain" link="protected.strains.new" canAdd=metaData.canAdd}} + + + + + + + + + + {{#each sortedStrains as |strain|}} + + + + + {{/each}} + +
SpeciesTotal Measurements
+ {{#link-to 'protected.strains.show' strain classBinding="data.typeStrain:type-strain"}} + {{strain.fullNameMU}} + {{/link-to}} + + {{strain.totalMeasurements}} +
diff --git a/app/pods/protected/strains/index/template.hbs b/app/pods/protected/strains/index/template.hbs index 851f93b..d441386 100644 --- a/app/pods/protected/strains/index/template.hbs +++ b/app/pods/protected/strains/index/template.hbs @@ -1,27 +1,6 @@

{{genus-name}} Strains

-

Total strains: {{model.length}}

-{{add-button label="Add Strain" link="protected.strains.new" canAdd=metaData.canAdd}} - - - - - - - - - - {{#each sortedStrains as |row|}} - - - - - {{/each}} - -
SpeciesTotal Measurements
- {{#link-to 'protected.strains.show' row classBinding="data.typeStrain:type-strain"}} - {{row.fullNameMU}} - {{/link-to}} - - {{row.totalMeasurements}} -
+{{ + protected/strains/index/strain-table + strains=model +}}