mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:54:23 +08:00
DEV: Clean up category-link (#24988)
The `style` variable is always set because every category has a color defined, so the surrounding if statement is unnecessary. "+ X categories" option has also been removed in the past and the code related to it is now dead code.
This commit is contained in:
parent
20f950a116
commit
a3bd86f85c
|
@ -111,6 +111,7 @@ export function defaultCategoryLinkRenderer(category, opts) {
|
|||
let href = opts.link === false ? "" : url;
|
||||
let tagName = opts.link === false || opts.link === "false" ? "span" : "a";
|
||||
let extraClasses = opts.extraClasses ? " " + opts.extraClasses : "";
|
||||
let style = `${categoryVariables(category)}`;
|
||||
let html = "";
|
||||
let parentCat = null;
|
||||
let categoryDir = "";
|
||||
|
@ -172,18 +173,7 @@ export function defaultCategoryLinkRenderer(category, opts) {
|
|||
href = ` href="${href}" `;
|
||||
}
|
||||
|
||||
let afterBadgeWrapper = "";
|
||||
|
||||
if (opts.plusSubcategories && opts.lastSubcategory) {
|
||||
afterBadgeWrapper += `<span class="plus-subcategories">
|
||||
${I18n.t("category_row.plus_subcategories", {
|
||||
count: opts.plusSubcategories,
|
||||
})}
|
||||
</span>`;
|
||||
}
|
||||
|
||||
const style = categoryVariables(category);
|
||||
const extraAttrs = style.string ? `style="${style}"` : "";
|
||||
|
||||
return `<${tagName} class="badge-category__wrapper ${extraClasses}" ${extraAttrs} ${href}>${html}</${tagName}>${afterBadgeWrapper}`;
|
||||
return `<${tagName} class="badge-category__wrapper ${extraClasses}" ${
|
||||
style.length > 0 ? `style="${style}"` : ""
|
||||
} ${href}>${html}</${tagName}>`;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user