Merge branch 'master' into clostridium
* master: Stopgap sort order + cleanup
This commit is contained in:
commit
236a622505
5 changed files with 14 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
import DS from 'ember-data';
|
import DS from 'ember-data';
|
||||||
import config from '../config/environment';
|
import config from '../config/environment';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default DS.Model.extend({
|
export default DS.Model.extend({
|
||||||
speciesName : DS.attr('string'),
|
speciesName : DS.attr('string'),
|
||||||
|
@ -14,4 +15,8 @@ export default DS.Model.extend({
|
||||||
createdBy : DS.attr('number'),
|
createdBy : DS.attr('number'),
|
||||||
updatedBy : DS.attr('number'),
|
updatedBy : DS.attr('number'),
|
||||||
deletedBy : DS.attr('number'),
|
deletedBy : DS.attr('number'),
|
||||||
|
|
||||||
|
speciesNameMU: function() {
|
||||||
|
return Ember.String.htmlSafe(`<em>${this.get('speciesName')}</em>`);
|
||||||
|
}.property('speciesName').readOnly(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,13 +20,9 @@ export default DS.Model.extend({
|
||||||
|
|
||||||
strainNameMU: function() {
|
strainNameMU: function() {
|
||||||
let type = this.get('typeStrain') ? '<sup>T</sup>' : '';
|
let type = this.get('typeStrain') ? '<sup>T</sup>' : '';
|
||||||
return `${this.get('strainName')}${type}`;
|
return Ember.String.htmlSafe(`${this.get('strainName')}${type}`);
|
||||||
}.property('strainName', 'typeStrain').readOnly(),
|
}.property('strainName', 'typeStrain').readOnly(),
|
||||||
|
|
||||||
fullName: function() {
|
|
||||||
return `${this.get('species.speciesName')} (strain ${this.get('strainName')})`;
|
|
||||||
}.property('species', 'strainName').readOnly(),
|
|
||||||
|
|
||||||
fullNameMU: function() {
|
fullNameMU: function() {
|
||||||
return Ember.String.htmlSafe(`<em>${this.get('species.speciesName')}</em> ${this.get('strainNameMU')}`);
|
return Ember.String.htmlSafe(`<em>${this.get('species.speciesName')}</em> ${this.get('strainNameMU')}`);
|
||||||
}.property('species', 'strainNameMU').readOnly(),
|
}.property('species', 'strainNameMU').readOnly(),
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default Ember.Controller.extend({
|
||||||
selectedStrains.forEach((strain) => {
|
selectedStrains.forEach((strain) => {
|
||||||
let s = this.store.getById('strain', strain);
|
let s = this.store.getById('strain', strain);
|
||||||
strains.pushObject(s);
|
strains.pushObject(s);
|
||||||
})
|
});
|
||||||
this.set('strains', strains);
|
this.set('strains', strains);
|
||||||
|
|
||||||
this.store.find('measurement', {
|
this.store.find('measurement', {
|
||||||
|
|
|
@ -11,9 +11,10 @@ export default Ember.Component.extend({
|
||||||
characteristics: this.store.findAll('characteristic'),
|
characteristics: this.store.findAll('characteristic'),
|
||||||
}).then((models) => {
|
}).then((models) => {
|
||||||
// Set up search parameters
|
// Set up search parameters
|
||||||
|
// Clean up sort order
|
||||||
let selects = [
|
let selects = [
|
||||||
{ model: 'species', id: 'id', text: 'speciesName',
|
{ model: 'species', id: 'id', text: 'speciesNameMU',
|
||||||
children: 'strains', cid: 'id', ctext: 'fullName' },
|
children: 'strains', cid: 'id', ctext: 'strainNameMU' },
|
||||||
{ model: 'characteristicTypes', id: 'id', text: 'characteristicTypeName',
|
{ model: 'characteristicTypes', id: 'id', text: 'characteristicTypeName',
|
||||||
children: 'characteristics', cid: 'id', ctext: 'characteristicName' },
|
children: 'characteristics', cid: 'id', ctext: 'characteristicName' },
|
||||||
];
|
];
|
||||||
|
@ -25,7 +26,8 @@ export default Ember.Component.extend({
|
||||||
models[item.model] = models[item.model].sortBy(item.text);
|
models[item.model] = models[item.model].sortBy(item.text);
|
||||||
let temp = models[item.model].map((data) => {
|
let temp = models[item.model].map((data) => {
|
||||||
let temp_children = [];
|
let temp_children = [];
|
||||||
data.get(item.children).forEach((child) => {
|
let sorted_children = data.get(item.children).sortBy(item.ctext);
|
||||||
|
sorted_children.forEach((child) => {
|
||||||
temp_children.push({id: child.get(item.cid), text: child.get(item.ctext)});
|
temp_children.push({id: child.get(item.cid), text: child.get(item.ctext)});
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -7,12 +7,12 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
},
|
},
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
var tableAttrs = [
|
var tableAttrs = [
|
||||||
{ name: 'Name', attr: 'fullName' },
|
{ name: 'Name', attr: 'fullNameMU' },
|
||||||
{ name: 'Total Measurements', attr: 'totalMeasurements' }
|
{ name: 'Total Measurements', attr: 'totalMeasurements' }
|
||||||
];
|
];
|
||||||
controller.set('model', model);
|
controller.set('model', model);
|
||||||
controller.set('tableAttrs', tableAttrs);
|
controller.set('tableAttrs', tableAttrs);
|
||||||
controller.set('row', 'strain-index-row');
|
controller.set('row', 'strain-index-row');
|
||||||
controller.set('sort', ['fullName']);
|
controller.set('sort', ['fullNameMU']);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue