Sort by strains and measurements

This commit is contained in:
Matthew Dillon 2015-03-19 13:01:43 -08:00
parent 86b3fb46d7
commit 37becad20a
11 changed files with 95 additions and 18 deletions

View file

@ -0,0 +1,5 @@
import SortableController from '../sortable';
export default SortableController.extend({
sortBy: 'characteristicName'
});

View file

@ -0,0 +1,18 @@
import Ember from 'ember';
export default Ember.ArrayController.extend({
queryParams: ['sortBy', 'sortAscending'],
sortAscending: true,
sortBy: null, // Set in subclass
// Make sortProperties computed so that we have a nice URL using sortBy
sortProperties: Ember.computed('sortBy', function() {
return [this.get('sortBy')];
}),
actions: {
setSortBy: function(fieldName) {
this.set('sortBy', fieldName);
this.toggleProperty('sortAscending');
return false;
}
}
});

View file

@ -0,0 +1,5 @@
import SortableController from '../sortable';
export default SortableController.extend({
sortBy: 'strainName',
});