discourse/app/assets/javascripts/select-kit/components/admin-group-selector.js.es6
2019-05-27 10:15:39 +02:00

34 lines
859 B
JavaScript

import MultiSelectComponent from "select-kit/components/multi-select";
import computed from "ember-addons/ember-computed-decorators";
const { makeArray } = Ember;
export default MultiSelectComponent.extend({
pluginApiIdentifiers: ["admin-group-selector"],
classNames: "admin-group-selector",
selected: null,
available: null,
allowAny: false,
buffer: null,
@computed("buffer")
values(buffer) {
return buffer === null
? makeArray(this.selected).map(s => this.valueForContentItem(s))
: buffer;
},
computeContent() {
return makeArray(this.available);
},
computeContentItem(contentItem, name) {
let computedContentItem = this._super(contentItem, name);
computedContentItem.locked = contentItem.automatic;
return computedContentItem;
},
mutateValues(values) {
this.set("buffer", values);
}
});