47 lines
801 B
JavaScript
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(" ");
|
|
}
|
|
});
|