1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/wizard/components/wizard-group-selector.js.es6

17 Zeilen
543 B
Text

2020-03-24 10:35:46 +01:00
import ComboBox from 'select-kit/components/combo-box';
import { computed } from "@ember/object";
import { makeArray } from "discourse-common/lib/helpers";
2020-03-30 08:16:03 +02:00
export default ComboBox.extend({
content: computed("groups.[]", "field.content.[]", function() {
const whitelist = makeArray(this.field.content);
2020-03-24 10:35:46 +01:00
return this.groups.filter(group => {
return !whitelist.length || whitelist.indexOf(group.id) > -1;
2020-03-30 08:16:03 +02:00
}).map(g => {
return {
id: g.id,
2020-04-16 01:32:35 +02:00
name: g.full_name ? g.full_name : g.name
2020-03-30 08:16:03 +02:00
}
2020-03-24 10:35:46 +01:00
});
})
})