Drop characteristic types

This commit is contained in:
Matthew Dillon 2015-07-13 08:27:03 -08:00
parent 99c94e9c7b
commit ea77042b19
6 changed files with 16 additions and 34 deletions

View file

@ -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'),
});

View file

@ -2,7 +2,7 @@ import DS from 'ember-data';
export default DS.Model.extend({
characteristicName : DS.attr('string'),
characteristicType: DS.belongsTo('characteristicType', { async: true }),
characteristicTypeName: DS.attr('string'),
strains : DS.hasMany('strain', { async: true }),
measurements : DS.hasMany('measurements', { async: true }),
createdAt : DS.attr('date'),

View file

@ -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 = [

View file

@ -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'),
});

View file

@ -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);
},
});

View file

@ -1,5 +1,5 @@
<h2>{{genus-name}} Characteristics</h2>
<h3>Total characteristics: {{characteristics.length}}</h3>
<h3>Total characteristics: {{model.length}}</h3>
<table class="flakes-table">
<thead>