FIX: displayCategoryDescription was not working correctly
This commit is contained in:
parent
77b5a49079
commit
5dd890eb3d
|
@ -6,7 +6,15 @@ import { categoryBadgeHTML } from "discourse/helpers/category-link";
|
|||
export default SelectKitRowComponent.extend({
|
||||
layoutName: "select-kit/templates/components/category-row",
|
||||
classNames: "category-row",
|
||||
displayCategoryDescription: true,
|
||||
|
||||
@computed("options.displayCategoryDescription")
|
||||
displayCategoryDescription(displayCategoryDescription) {
|
||||
if (Ember.isNone(displayCategoryDescription)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return displayCategoryDescription;
|
||||
},
|
||||
|
||||
@computed("computedContent.value", "computedContent.name")
|
||||
category(value, name) {
|
||||
|
@ -51,8 +59,8 @@ export default SelectKitRowComponent.extend({
|
|||
|
||||
topicCount: Ember.computed.alias("category.topic_count"),
|
||||
|
||||
@computed("options.displayCategoryDescription", "category.description")
|
||||
hasDescription(displayCategoryDescription, description) {
|
||||
@computed("displayCategoryDescription", "category.description")
|
||||
shouldDisplayDescription(displayCategoryDescription, description) {
|
||||
return displayCategoryDescription && description && description !== "null";
|
||||
},
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ export default MultiSelectComponent.extend({
|
|||
init() {
|
||||
this._super();
|
||||
|
||||
this.set("headerComponentOptions", Ember.Object.create({
|
||||
this.get("headerComponentOptions").setProperties({
|
||||
selectedNameComponent: "multi-select/selected-category"
|
||||
}));
|
||||
});
|
||||
|
||||
this.set("rowComponentOptions", Ember.Object.create({
|
||||
this.get("rowComponentOptions").setProperties({
|
||||
displayCategoryDescription: false
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
computeValues() {
|
||||
|
|
|
@ -9,6 +9,14 @@ export default CategoryChooserComponent.extend({
|
|||
allowUncategorized: true,
|
||||
clearable: true,
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
|
||||
this.get("rowComponentOptions").setProperties({
|
||||
displayCategoryDescription: false
|
||||
});
|
||||
},
|
||||
|
||||
mutateValue(value) {
|
||||
if (value) {
|
||||
this.set("value", Category.findById(value));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if hasDescription}}
|
||||
{{#if shouldDisplayDescription}}
|
||||
<div class="category-desc">{{description}}</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
|
|
Loading…
Reference in New Issue