2017-11-21 05:53:09 -05:00
|
|
|
import CategoryChooserComponent from "select-kit/components/category-chooser";
|
|
|
|
import Category from "discourse/models/category";
|
|
|
|
|
|
|
|
export default CategoryChooserComponent.extend({
|
2017-11-21 08:47:53 -05:00
|
|
|
pluginApiIdentifiers: ["search-advanced-category-chooser"],
|
|
|
|
classNames: ["search-advanced-category-chooser"],
|
2017-11-21 05:53:09 -05:00
|
|
|
rootNone: true,
|
|
|
|
rootNoneLabel: "category.all",
|
|
|
|
allowUncategorized: true,
|
|
|
|
clearable: true,
|
2018-01-25 06:03:13 -05:00
|
|
|
permissionType: null,
|
2017-11-21 05:53:09 -05:00
|
|
|
|
2017-11-21 09:38:30 -05:00
|
|
|
init() {
|
|
|
|
this._super();
|
|
|
|
|
|
|
|
this.get("rowComponentOptions").setProperties({
|
|
|
|
displayCategoryDescription: false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-11-21 05:53:09 -05:00
|
|
|
mutateValue(value) {
|
|
|
|
if (value) {
|
|
|
|
this.set("value", Category.findById(value));
|
|
|
|
} else {
|
|
|
|
this.set("value", null);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computeValue(category) { if (category) return category.id; }
|
|
|
|
});
|