FIX: check can_create_tags on mini-tag-chooser as tag-chooser (#7260)

This commit is contained in:
Joffrey JAFFEUX 2019-03-26 16:45:38 +01:00 committed by GitHub
parent 4874cf742b
commit b2cacc5b0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -16,7 +16,8 @@ export default ComboBox.extend(TagsMixin, {
verticalOffset: 3, verticalOffset: 3,
filterable: true, filterable: true,
noTags: Ember.computed.empty("selection"), noTags: Ember.computed.empty("selection"),
allowAny: true, allowCreate: null,
allowAny: Ember.computed.alias("allowCreate"),
caretUpIcon: Ember.computed.alias("caretIcon"), caretUpIcon: Ember.computed.alias("caretIcon"),
caretDownIcon: Ember.computed.alias("caretIcon"), caretDownIcon: Ember.computed.alias("caretIcon"),
isAsync: true, isAsync: true,
@ -28,6 +29,10 @@ export default ComboBox.extend(TagsMixin, {
this.set("termMatchesForbidden", false); this.set("termMatchesForbidden", false);
this.selectionSelector = ".selected-tag"; this.selectionSelector = ".selected-tag";
if (this.get("allowCreate") !== false) {
this.set("allowCreate", this.site.get("can_create_tag"));
}
this.set("templateForRow", rowComponent => { this.set("templateForRow", rowComponent => {
const tag = rowComponent.get("computedContent"); const tag = rowComponent.get("computedContent");
return renderTag(get(tag, "value"), { return renderTag(get(tag, "value"), {

View File

@ -13,6 +13,7 @@ export default MultiSelectComponent.extend(TagsMixin, {
limit: null, limit: null,
blacklist: null, blacklist: null,
attributeBindings: ["categoryId"], attributeBindings: ["categoryId"],
allowCreate: null,
allowAny: Ember.computed.alias("allowCreate"), allowAny: Ember.computed.alias("allowCreate"),
init() { init() {