DEV: Switch site-settings category-list component to gjs (#25569)
This commit is contained in:
parent
3159522546
commit
a20bf843fc
|
@ -0,0 +1,28 @@
|
|||
import Component from "@ember/component";
|
||||
import { action, computed } from "@ember/object";
|
||||
import Category from "discourse/models/category";
|
||||
import htmlSafe from "discourse-common/helpers/html-safe";
|
||||
import SettingValidationMessage from "admin/components/setting-validation-message";
|
||||
import CategorySelector from "select-kit/components/category-selector";
|
||||
|
||||
export default class CategoryList extends Component {
|
||||
@computed("value")
|
||||
get selectedCategories() {
|
||||
return Category.findByIds(this.value.split("|").filter(Boolean));
|
||||
}
|
||||
|
||||
@action
|
||||
onChangeSelectedCategories(value) {
|
||||
this.set("value", (value || []).mapBy("id").join("|"));
|
||||
}
|
||||
|
||||
<template>
|
||||
<CategorySelector
|
||||
@categories={{this.selectedCategories}}
|
||||
@onChange={{this.onChangeSelectedCategories}}
|
||||
/>
|
||||
|
||||
<div class="desc">{{htmlSafe this.setting.description}}</div>
|
||||
<SettingValidationMessage @message={{this.validationMessage}} />
|
||||
</template>
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<CategorySelector
|
||||
@categories={{this.selectedCategories}}
|
||||
@onChange={{this.onChangeSelectedCategories}}
|
||||
/>
|
||||
|
||||
<div class="desc">{{html-safe this.setting.description}}</div>
|
||||
<SettingValidationMessage @message={{this.validationMessage}} />
|
|
@ -1,15 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
import { action, computed } from "@ember/object";
|
||||
import Category from "discourse/models/category";
|
||||
|
||||
export default class CategoryList extends Component {
|
||||
@computed("value")
|
||||
get selectedCategories() {
|
||||
return Category.findByIds(this.value.split("|").filter(Boolean));
|
||||
}
|
||||
|
||||
@action
|
||||
onChangeSelectedCategories(value) {
|
||||
this.set("value", (value || []).mapBy("id").join("|"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue