mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: duplicated categories in select-box
This commit is contained in:
parent
a4e3e081c9
commit
21d6c7f6b3
@ -74,7 +74,6 @@ export default SelectBoxComponent.extend({
|
|||||||
|
|
||||||
rowContentTemplate(item) {
|
rowContentTemplate(item) {
|
||||||
let category;
|
let category;
|
||||||
let result = '<div class="category-status">';
|
|
||||||
|
|
||||||
// If we have no id, but text with the uncategorized name, we can use that badge.
|
// If we have no id, but text with the uncategorized name, we can use that badge.
|
||||||
if (Ember.isEmpty(item.id)) {
|
if (Ember.isEmpty(item.id)) {
|
||||||
@ -87,18 +86,20 @@ export default SelectBoxComponent.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!category) return item.text;
|
if (!category) return item.text;
|
||||||
result += categoryBadgeHTML(category, {link: false, allowUncategorized: true, hideParent: true});
|
let result = categoryBadgeHTML(category, {link: false, allowUncategorized: true, hideParent: true});
|
||||||
const parentCategoryId = category.get("parent_category_id");
|
const parentCategoryId = category.get("parent_category_id");
|
||||||
|
|
||||||
if (parentCategoryId) {
|
if (parentCategoryId) {
|
||||||
result += categoryBadgeHTML(Category.findById(parentCategoryId), {link: false}) + " " + result;
|
result = `<div class="category-status">${categoryBadgeHTML(Category.findById(parentCategoryId), {link: false})} ${result}`;
|
||||||
|
} else {
|
||||||
|
result = `<div class="category-status">${result}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
result += ` <span class='topic-count'>× ${category.get("topic_count")}</span></div>`;
|
result += ` <span class="topic-count">× ${category.get("topic_count")}</span></div>`;
|
||||||
|
|
||||||
const description = category.get("description");
|
const description = category.get("description");
|
||||||
// TODO wtf how can this be null?;
|
// TODO wtf how can this be null?;
|
||||||
if (description && description !== 'null') {
|
if (description && description !== "null") {
|
||||||
result += `<div class="category-desc">${description.substr(0, 200)}${description.length > 200 ? '…' : ''}</div>`;
|
result += `<div class="category-desc">${description.substr(0, 200)}${description.length > 200 ? '…' : ''}</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user