2020-02-03 08:22:14 -05:00
|
|
|
import { computed } from "@ember/object";
|
2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2019-04-18 13:44:58 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend({
|
2020-02-03 08:22:14 -05:00
|
|
|
tokenSeparator: "|",
|
|
|
|
|
|
|
|
nameProperty: "name",
|
|
|
|
valueProperty: "id",
|
|
|
|
|
|
|
|
groupChoices: computed("site.groups", function() {
|
|
|
|
return (this.site.groups || []).map(g => {
|
2019-07-19 14:17:58 -04:00
|
|
|
return { name: g.name, id: g.id.toString() };
|
|
|
|
});
|
2020-02-03 08:22:14 -05:00
|
|
|
}),
|
|
|
|
|
|
|
|
settingValue: computed("value", function() {
|
|
|
|
return (this.value || "").split(this.tokenSeparator).filter(Boolean);
|
|
|
|
}),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
onChangeGroupListSetting(value) {
|
|
|
|
this.set("value", value.join(this.tokenSeparator));
|
|
|
|
}
|
2019-04-18 13:44:58 -04:00
|
|
|
}
|
|
|
|
});
|