DEV: Convert raw-views to native class syntax (#28607)
Changes made using the ember-native-class-codemod, plus some manual tweaks
This commit is contained in:
parent
cb883ceb74
commit
a0d2cb052e
|
@ -2,21 +2,21 @@ import EmberObject from "@ember/object";
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default EmberObject.extend({
|
||||
export default class NewListHeaderControls extends EmberObject {
|
||||
@discourseComputed
|
||||
topicsActive() {
|
||||
return this.current === "topics";
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
repliesActive() {
|
||||
return this.current === "replies";
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
allActive() {
|
||||
return !this.topicsActive && !this.repliesActive;
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
repliesButtonLabel() {
|
||||
|
@ -27,7 +27,7 @@ export default EmberObject.extend({
|
|||
} else {
|
||||
return I18n.t("filters.new.replies");
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
topicsButtonLabel() {
|
||||
|
@ -38,7 +38,7 @@ export default EmberObject.extend({
|
|||
} else {
|
||||
return I18n.t("filters.new.topics");
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
staticLabel() {
|
||||
|
@ -53,5 +53,5 @@ export default EmberObject.extend({
|
|||
} else {
|
||||
return this.repliesButtonLabel;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ import { and } from "@ember/object/computed";
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default EmberObject.extend({
|
||||
showBadges: and("postBadgesEnabled", "topic.unread_posts"),
|
||||
export default class PostCountOrBadges extends EmberObject {
|
||||
@and("postBadgesEnabled", "topic.unread_posts") showBadges;
|
||||
|
||||
@discourseComputed
|
||||
newDotText() {
|
||||
return this.currentUser && this.currentUser.trust_level > 0
|
||||
? ""
|
||||
: I18n.t("filters.new.lower_title");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ import EmberObject from "@ember/object";
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default EmberObject.extend({
|
||||
tagName: "td",
|
||||
export default class PostsCountColumn extends EmberObject {
|
||||
tagName = "td";
|
||||
|
||||
@discourseComputed("topic.like_count", "topic.posts_count")
|
||||
ratio(likeCount, postCount) {
|
||||
|
@ -15,7 +15,7 @@ export default EmberObject.extend({
|
|||
}
|
||||
|
||||
return (likes || 0) / posts;
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed("topic.replyCount", "ratioText")
|
||||
title(count, ratio) {
|
||||
|
@ -23,7 +23,7 @@ export default EmberObject.extend({
|
|||
count,
|
||||
ratio,
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed("ratio")
|
||||
ratioText(ratio) {
|
||||
|
@ -38,12 +38,12 @@ export default EmberObject.extend({
|
|||
return "low";
|
||||
}
|
||||
return "";
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed("ratioText")
|
||||
likesHeat(ratioText) {
|
||||
if (ratioText && ratioText.length) {
|
||||
return `heatmap-${ratioText}`;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default EmberObject.extend({
|
||||
export default class VisitedLine extends EmberObject {
|
||||
@discourseComputed
|
||||
isLastVisited() {
|
||||
return this.lastVisitedTopic === this.topic;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,10 @@ import { and } from "@ember/object/computed";
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default EmberObject.extend({
|
||||
sortable: null,
|
||||
ariaPressed: and("sortable", "isSorting"),
|
||||
export default class TopicListHeaderColumn extends EmberObject {
|
||||
sortable = null;
|
||||
|
||||
@and("sortable", "isSorting") ariaPressed;
|
||||
|
||||
@discourseComputed
|
||||
localizedName() {
|
||||
|
@ -14,7 +15,7 @@ export default EmberObject.extend({
|
|||
}
|
||||
|
||||
return this.name ? I18n.t(this.name) : "";
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
sortIcon() {
|
||||
|
@ -26,7 +27,7 @@ export default EmberObject.extend({
|
|||
).toString() === "true";
|
||||
|
||||
return `chevron-${isAscending ? "up" : "down"}`;
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
isSorting() {
|
||||
|
@ -35,7 +36,7 @@ export default EmberObject.extend({
|
|||
(this.parent.order === this.order ||
|
||||
this.parent.context?.order === this.order)
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
className() {
|
||||
|
@ -58,7 +59,7 @@ export default EmberObject.extend({
|
|||
}
|
||||
|
||||
return name.join(" ");
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
ariaSort() {
|
||||
|
@ -67,5 +68,5 @@ export default EmberObject.extend({
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ import EmberObject from "@ember/object";
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default EmberObject.extend({
|
||||
showDefault: null,
|
||||
export default class TopicStatus extends EmberObject {
|
||||
showDefault = null;
|
||||
|
||||
@discourseComputed("defaultIcon")
|
||||
renderDiv(defaultIcon) {
|
||||
return (defaultIcon || this.statuses.length > 0) && !this.noDiv;
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed
|
||||
statuses() {
|
||||
|
@ -95,5 +95,5 @@ export default EmberObject.extend({
|
|||
this.set("showDefault", defaultIcon);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue