A platform for community discussion. Free, open, simple.
FEATURE: Add more class names to latest-topic-list-item (#12933)
Krisf57878f20f3d
diff --git a/app/assets/javascripts/discourse/app/components/latest-topic-list-item.js b/app/assets/javascripts/discourse/app/components/latest-topic-list-item.jsindex 96fc9310b2e..d6cb6347a51 100644--- a/app/assets/javascripts/discourse/app/components/latest-topic-list-item.js+++ b/app/assets/javascripts/discourse/app/components/latest-topic-list-item.js@@ -3,15 +3,11 @@ import {showEntrance,} from "discourse/components/topic-list-item";import Component from "@ember/component";+import discourseComputed from "discourse-common/utils/decorators";export default Component.extend({attributeBindings: ["topic.id:data-topic-id"],- classNameBindings: [- ":latest-topic-list-item",- "topic.archived",- "topic.visited",- "topic.pinned",- ],+ classNameBindings: [":latest-topic-list-item", "unboundClassNames"],showEntrance,navigateToTopic,@@ -27,4 +23,27 @@ export default Component.extend({// Can be overwritten by plugins to handle clicks on other parts of the rowunhandledRowClick() {},++ @discourseComputed("topic")+ unboundClassNames(topic) {+ let classes = [];++ if (topic.get("category")) {+ classes.push("category-" + topic.get("category.fullSlug"));+ }++ if (topic.get("tags")) {+ topic.get("tags").forEach((tagName) => classes.push("tag-" + tagName));+ }++ ["liked", "archived", "bookmarked", "pinned", "closed", "visited"].forEach(+ (name) => {+ if (topic.get(name)) {+ classes.push(name);+ }+ }+ );++ return classes.join(" ");+ },});