FIX: better handling of category badge when displaying sub and parent cat
This commit is contained in:
parent
f07b1a5c05
commit
3ad0266dd8
|
@ -64,10 +64,11 @@ export default ComboBoxComponent.extend({
|
|||
if (this.get("hasSelection")) {
|
||||
const category = Category.findById(content.value);
|
||||
const parentCategoryId = category.get("parent_category_id");
|
||||
const hasParentCategory = Ember.isPresent(parentCategoryId);
|
||||
|
||||
let badge = "";
|
||||
|
||||
if (!Ember.isNone(parentCategoryId)) {
|
||||
if (hasParentCategory) {
|
||||
const parentCategory = Category.findById(parentCategoryId);
|
||||
badge += categoryBadgeHTML(parentCategory, {
|
||||
link: false,
|
||||
|
@ -77,6 +78,7 @@ export default ComboBoxComponent.extend({
|
|||
|
||||
badge += categoryBadgeHTML(category, {
|
||||
link: false,
|
||||
hideParent: hasParentCategory ? true : false,
|
||||
allowUncategorized: true
|
||||
}).htmlSafe();
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ export default SelectKitRowComponent.extend({
|
|||
}
|
||||
},
|
||||
|
||||
@computed("category")
|
||||
badgeForCategory(category) {
|
||||
@computed("category", "parentCategory")
|
||||
badgeForCategory(category, parentCategory) {
|
||||
return categoryBadgeHTML(category, {
|
||||
link: this.get("categoryLink"),
|
||||
allowUncategorized: this.get("allowUncategorized"),
|
||||
hideParent: this.get("hideParentCategory")
|
||||
hideParent: parentCategory ? true : false
|
||||
}).htmlSafe();
|
||||
},
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default CategoryRowComponent.extend({
|
|||
return categoryBadgeHTML(category, {
|
||||
link: this.get("categoryLink"),
|
||||
allowUncategorized: true,
|
||||
hideParent: this.get("hideParentCategory")
|
||||
hideParent: true
|
||||
}).htmlSafe();
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue