diff --git a/app/models/characteristic-type.js b/app/models/characteristic-type.js deleted file mode 100644 index 284486e..0000000 --- a/app/models/characteristic-type.js +++ /dev/null @@ -1,13 +0,0 @@ -import DS from 'ember-data'; - -export default DS.Model.extend({ - characteristicTypeName: DS.attr('string'), - characteristics: DS.hasMany('characteristic', { async: true }), - createdAt: DS.attr('date'), - updatedAt: DS.attr('date'), - deletedAt: DS.attr('date'), - createdBy: DS.attr('number'), - updatedBy: DS.attr('number'), - deletedBy: DS.attr('number'), - sortOrder: DS.attr('number'), -}); diff --git a/app/models/characteristic.js b/app/models/characteristic.js index 9f33d7b..d896ca1 100644 --- a/app/models/characteristic.js +++ b/app/models/characteristic.js @@ -1,15 +1,15 @@ import DS from 'ember-data'; export default DS.Model.extend({ - characteristicName: DS.attr('string'), - characteristicType: DS.belongsTo('characteristicType', { async: true }), - strains : DS.hasMany('strain', { async: true }), - measurements : DS.hasMany('measurements', { async: true }), - createdAt : DS.attr('date'), - updatedAt : DS.attr('date'), - deletedAt : DS.attr('date'), - createdBy : DS.attr('number'), - updatedBy : DS.attr('number'), - deletedBy : DS.attr('number'), - sortOrder : DS.attr('number'), + characteristicName : DS.attr('string'), + characteristicTypeName: DS.attr('string'), + strains : DS.hasMany('strain', { async: true }), + measurements : DS.hasMany('measurements', { async: true }), + createdAt : DS.attr('date'), + updatedAt : DS.attr('date'), + deletedAt : DS.attr('date'), + createdBy : DS.attr('number'), + updatedBy : DS.attr('number'), + deletedBy : DS.attr('number'), + sortOrder : DS.attr('number'), }); diff --git a/app/pods/components/measurement-search-panel/component.js b/app/pods/components/measurement-search-panel/component.js index b9e9749..56d60d5 100644 --- a/app/pods/components/measurement-search-panel/component.js +++ b/app/pods/components/measurement-search-panel/component.js @@ -7,9 +7,10 @@ export default Ember.Component.extend({ Ember.RSVP.hash({ species: this.store.findAll('species'), strains: this.store.findAll('strain'), - characteristicTypes: this.store.findAll('characteristic-type'), characteristics: this.store.findAll('characteristic'), }).then((models) => { + models['characteristicTypes'] = models.characteristics.mapBy('characteristicTypeName').uniq(); + // Set up search parameters // Clean up sort order let selects = [ diff --git a/app/pods/protected/characteristics/controller.js b/app/pods/protected/characteristics/controller.js index 88d2200..d1d9ed1 100644 --- a/app/pods/protected/characteristics/controller.js +++ b/app/pods/protected/characteristics/controller.js @@ -2,5 +2,5 @@ import Ember from 'ember'; export default Ember.Controller.extend({ sortParams: ['characteristicType.characteristicTypeName', 'sortOrder'], - sortedCharacteristics: Ember.computed.sort('characteristics', 'sortParams'), + sortedCharacteristics: Ember.computed.sort('model', 'sortParams'), }); diff --git a/app/pods/protected/characteristics/route.js b/app/pods/protected/characteristics/route.js index 6fc0c60..77c7739 100644 --- a/app/pods/protected/characteristics/route.js +++ b/app/pods/protected/characteristics/route.js @@ -3,13 +3,7 @@ import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixi export default Ember.Route.extend(AuthenticatedRouteMixin, { model: function() { - return Ember.RSVP.hash({ - characteristicTypes: this.store.findAll('characteristic-type'), - characteristics: this.store.findAll('characteristic'), - }); + return this.store.findAll('characteristic'); }, - setupController: function(controller, models) { - controller.setProperties(models); - }, }); diff --git a/app/pods/protected/characteristics/template.hbs b/app/pods/protected/characteristics/template.hbs index cc21bab..b9bd848 100644 --- a/app/pods/protected/characteristics/template.hbs +++ b/app/pods/protected/characteristics/template.hbs @@ -1,5 +1,5 @@

{{genus-name}} Characteristics

-

Total characteristics: {{characteristics.length}}

+

Total characteristics: {{model.length}}