2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2018-07-20 02:33:11 +08:00
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2018-07-20 02:33:11 +08:00
|
|
|
tagName: "th",
|
|
|
|
classNames: ["admin-report-table-header"],
|
2018-08-02 06:40:59 +08:00
|
|
|
classNameBindings: ["label.mainProperty", "label.type", "isCurrentSort"],
|
2018-07-20 02:33:11 +08:00
|
|
|
attributeBindings: ["label.title:title"],
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("currentSortLabel.sortProperty", "label.sortProperty")
|
2018-07-20 02:33:11 +08:00
|
|
|
isCurrentSort(currentSortField, labelSortField) {
|
|
|
|
return currentSortField === labelSortField;
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("currentSortDirection")
|
2018-07-20 02:33:11 +08:00
|
|
|
sortIcon(currentSortDirection) {
|
|
|
|
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
|
|
|
},
|
|
|
|
});
|