Skip to content

A platform for community discussion. Free, open, simple.

FIX: update minimum required tag when switching categories in composer

Penar Musarajc5b1f028edaa
diff --git a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js b/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js
index 94b9fa055ad..5c7035a0229 100644
--- a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js
+++ b/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js
@@ -10,7 +10,6 @@ const SELECTED_TAGS_COLLECTION = "MINI_TAG_CHOOSER_SELECTED_TAGS";
import { ERRORS_COLLECTION } from "select-kit/components/select-kit";
export default ComboBox.extend(TagsMixin, {
- headerComponent: "mini-tag-chooser/mini-tag-chooser-header",
pluginApiIdentifiers: ["mini-tag-chooser"],
attributeBindings: ["selectKit.options.categoryId:category-id"],
classNames: ["mini-tag-chooser"],
@@ -31,6 +30,7 @@ export default ComboBox.extend(TagsMixin, {
),
selectKitOptions: {
+ headerComponent: "mini-tag-chooser/mini-tag-chooser-header",
fullWidthOnMobile: true,
filterable: true,
caretDownIcon: "caretIcon",
diff --git a/app/assets/javascripts/select-kit/addon/components/single-select.js b/app/assets/javascripts/select-kit/addon/components/single-select.js
index 7338d80ecfd..12ed3fef674 100644
--- a/app/assets/javascripts/select-kit/addon/components/single-select.js
+++ b/app/assets/javascripts/select-kit/addon/components/single-select.js
@@ -12,31 +12,36 @@ export default SelectKitComponent.extend({
headerComponent: "select-kit/single-select-header"
},
- selectedContent: computed("value", "content.[]", function() {
- if (!isEmpty(this.value)) {
- let content;
+ selectedContent: computed(
+ "value",
+ "content.[]",
+ "selectKit.noneItem",
+ function() {
+ if (!isEmpty(this.value)) {
+ let content;
- const value =
- this.selectKit.options.castInteger && this._isNumeric(this.value)
- ? Number(this.value)
- : this.value;
+ const value =
+ this.selectKit.options.castInteger && this._isNumeric(this.value)
+ ? Number(this.value)
+ : this.value;
- if (this.selectKit.valueProperty) {
- content = (this.content || []).findBy(
- this.selectKit.valueProperty,
- value
- );
+ if (this.selectKit.valueProperty) {
+ content = (this.content || []).findBy(
+ this.selectKit.valueProperty,
+ value
+ );
- return this.selectKit.modifySelection(
- content || this.defaultItem(value, value)
- );
+ return this.selectKit.modifySelection(
+ content || this.defaultItem(value, value)
+ );
+ } else {
+ return this.selectKit.modifySelection(
+ (this.content || []).filter(c => c === value)
+ );
+ }
} else {
- return this.selectKit.modifySelection(
- (this.content || []).filter(c => c === value)
- );
+ return this.selectKit.noneItem;
}
- } else {
- return this.selectKit.noneItem;
}
- })
+ )
});