github.com/emate/nomad@v0.8.2-wo-binpacking/ui/app/components/list-table/sort-by.js (about) 1 import Component from '@ember/component'; 2 import { computed } from '@ember/object'; 3 4 export default Component.extend({ 5 tagName: 'th', 6 7 attributeBindings: ['title'], 8 9 // The prop that the table is currently sorted by 10 currentProp: '', 11 12 // The prop this sorter controls 13 prop: '', 14 15 classNames: ['is-selectable'], 16 classNameBindings: ['isActive:is-active', 'sortDescending:desc:asc'], 17 18 isActive: computed('currentProp', 'prop', function() { 19 return this.get('currentProp') === this.get('prop'); 20 }), 21 22 shouldSortDescending: computed('sortDescending', 'isActive', function() { 23 return !this.get('isActive') || !this.get('sortDescending'); 24 }), 25 });