Sort by strains and measurements
This commit is contained in:
parent
86b3fb46d7
commit
37becad20a
11 changed files with 95 additions and 18 deletions
5
app/controllers/measurements/index.js
Normal file
5
app/controllers/measurements/index.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import SortableController from '../sortable';
|
||||
|
||||
export default SortableController.extend({
|
||||
sortBy: 'characteristicName'
|
||||
});
|
18
app/controllers/sortable.js
Normal file
18
app/controllers/sortable.js
Normal 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;
|
||||
}
|
||||
}
|
||||
});
|
5
app/controllers/strains/index.js
Normal file
5
app/controllers/strains/index.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import SortableController from '../sortable';
|
||||
|
||||
export default SortableController.extend({
|
||||
sortBy: 'strainName',
|
||||
});
|
Reference in a new issue