This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js
2020-03-12 13:29:55 -04:00

48 lines
866 B
JavaScript

import EmberObject from "@ember/object";
import discourseComputed from "discourse-common/utils/decorators";
export default EmberObject.extend({
@discourseComputed
localizedName() {
if (this.forceName) {
return this.forceName;
}
return this.name ? I18n.t(this.name) : "";
},
@discourseComputed
sortIcon() {
const asc = this.parent.ascending ? "up" : "down";
return `chevron-${asc}`;
},
@discourseComputed
isSorting() {
return this.sortable && this.parent.order === this.order;
},
@discourseComputed
className() {
const name = [];
if (this.order) {
name.push(this.order);
}
if (this.sortable) {
name.push("sortable");
if (this.isSorting) {
name.push("sorting");
}
}
if (this.number) {
name.push("num");
}
return name.join(" ");
}
});