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.es6
2019-05-27 10:15:39 +02:00

47 lines
801 B
JavaScript

import { default as computed } from "ember-addons/ember-computed-decorators";
export default Ember.Object.extend({
@computed
localizedName() {
if (this.forceName) {
return this.forceName;
}
return this.name ? I18n.t(this.name) : "";
},
@computed
sortIcon() {
const asc = this.parent.ascending ? "up" : "down";
return `chevron-${asc}`;
},
@computed
isSorting() {
return this.sortable && this.parent.order === this.order;
},
@computed
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(" ");
}
});