github.com/blixtra/nomad@v0.7.2-0.20171221000451-da9a1d7bb050/ui/app/components/list-table/sort-by.js (about)

     1  import Ember from 'ember';
     2  
     3  const { Component, computed } = Ember;
     4  
     5  export default Component.extend({
     6    tagName: 'th',
     7  
     8    attributeBindings: ['title'],
     9  
    10    // The prop that the table is currently sorted by
    11    currentProp: '',
    12  
    13    // The prop this sorter controls
    14    prop: '',
    15  
    16    classNames: ['is-selectable'],
    17    classNameBindings: ['isActive:is-active', 'sortDescending:desc:asc'],
    18  
    19    isActive: computed('currentProp', 'prop', function() {
    20      return this.get('currentProp') === this.get('prop');
    21    }),
    22  
    23    shouldSortDescending: computed('sortDescending', 'isActive', function() {
    24      return !this.get('isActive') || !this.get('sortDescending');
    25    }),
    26  });