DEV: Add class to header-topic-info widget (#9475)

This commit is contained in:
Mark VanLandingham 2020-04-20 10:34:05 -05:00 committed by GitHub
parent 0a3cc22cec
commit e5233f5ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,10 @@ createWidget("topic-header-participant", {
export default createWidget("header-topic-info", {
tagName: "div.extra-info-wrapper",
buildClasses(attrs) {
return this.showCategory(attrs.topic) ? "two-rows" : "";
},
buildFancyTitleClass() {
const baseClass = ["topic-link"];
const flatten = array => [].concat.apply([], array);
@ -112,11 +116,7 @@ export default createWidget("header-topic-info", {
const category = topic.get("category");
if (loaded || category) {
if (
category &&
(!category.get("isUncategorizedCategory") ||
!this.siteSettings.suppress_uncategorized_badge)
) {
if (this.showCategory(topic)) {
const parentCategory = category.get("parentCategory");
const categories = [];
if (parentCategory) {
@ -208,6 +208,14 @@ export default createWidget("header-topic-info", {
);
},
showCategory(topic) {
return (
topic.category &&
(!topic.category.isUncategorizedCategory ||
!this.siteSettings.suppress_uncategorized_badge)
);
},
jumpToTopPost() {
const topic = this.attrs.topic;
if (topic) {