1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/wizard/components/wizard-group-selector.js.es6
2022-06-15 08:59:09 +02:00

20 Zeilen
646 B
JavaScript

import ComboBox from "select-kit/components/combo-box";
import { computed } from "@ember/object";
import { makeArray } from "discourse-common/lib/helpers";
export default ComboBox.extend({
layoutName: "wizard/templates/components/wizard-group-selector",
content: computed("groups.[]", "field.content.[]", function () {
const whitelist = makeArray(this.field.content);
return this.groups
.filter((group) => {
return !whitelist.length || whitelist.indexOf(group.id) > -1;
})
.map((g) => {
return {
id: g.id,
name: g.full_name ? g.full_name : g.name,
};
});
}),
});