2021-03-28 11:06:49 +02:00
|
|
|
import ComboBox from "select-kit/components/combo-box";
|
2020-03-24 10:35:46 +01:00
|
|
|
import { computed } from "@ember/object";
|
|
|
|
import { makeArray } from "discourse-common/lib/helpers";
|
|
|
|
|
2021-03-28 11:06:49 +02:00
|
|
|
export default ComboBox.extend({
|
2022-03-16 12:33:34 +01:00
|
|
|
layoutName: 'wizard/templates/components/wizard-group-selector',
|
2021-03-28 11:06:49 +02:00
|
|
|
content: computed("groups.[]", "field.content.[]", function () {
|
2020-03-30 08:16:03 +02:00
|
|
|
const whitelist = makeArray(this.field.content);
|
2021-03-28 11:06:49 +02:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
});
|