Skip to content

A platform for community discussion. Free, open, simple.

REFACTOR: topic-list-header-column (#7099)

Joffrey JAFFEUXbb39a6f7d71f
diff --git a/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6 b/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6
index 58cdc078337..bedf8048d05 100644
--- a/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6
+++ b/app/assets/javascripts/discourse/raw-views/topic-list-header-column.js.es6
@@ -1,25 +1,34 @@
+import { default as computed } from "ember-addons/ember-computed-decorators";
+
export default Ember.Object.extend({
- localizedName: function() {
+ @computed
+ localizedName() {
if (this.forceName) {
return this.forceName;
}
return this.name ? I18n.t(this.name) : "";
- }.property(),
+ },
- sortIcon: function() {
- return "chevron-" + (this.parent.ascending ? "up" : "down");
- }.property(),
+ @computed
+ sortIcon() {
+ const asc = this.parent.ascending ? "up" : "down";
+ return `chevron-${asc}`;
+ },
- isSorting: function() {
+ @computed
+ isSorting() {
return this.sortable && this.parent.order === this.order;
- }.property(),
+ },
+
+ @computed
+ className() {
+ const name = [];
- className: function() {
- var name = [];
if (this.order) {
name.push(this.order);
}
+
if (this.sortable) {
name.push("sortable");
@@ -33,5 +42,5 @@ export default Ember.Object.extend({
}
return name.join(" ");
- }.property()
+ }
});