A platform for community discussion. Free, open, simple.
UX: Minor change to compact tag chooser (#22796)
Penar Musarajf2048eeb4c7e
diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbsindex aa362ea5d04..a830830a10e 100644--- a/app/assets/javascripts/discourse/app/templates/topic.hbs+++ b/app/assets/javascripts/discourse/app/templates/topic.hbs@@ -72,7 +72,7 @@filterable=truecategoryId=this.buffered.category_idminimum=this.minimumRequiredTags- filterPlaceholder="topic_edit.tag_filter_placeholder"+ filterPlaceholder="tagging.choose_for_topic"useHeaderFilter=true}}/>diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.jsindex 876ed6b859a..29a68d284a3 100644--- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js@@ -206,6 +206,25 @@ module(assert.dom(".select-kit-collection").doesNotExist();assert.dom(".select-kit-header button[data-name='apple']").doesNotExist();assert.strictEqual(this.subject.header().value(), "orange,potato");++ assert+ .dom(".select-kit-header .filter-input")+ .hasAttribute(+ "placeholder",+ "",+ "Placeholder is empty when there is a selection"+ );++ await click(".select-kit-header button[data-name='orange']");+ await click(".select-kit-header button[data-name='potato']");++ assert+ .dom(".select-kit-header .filter-input")+ .hasAttribute(+ "placeholder",+ "Search...",+ "Placeholder is back to default when there is no selection"+ );});});diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.hbs b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.hbsindex d0f57faf828..f9099884900 100644--- a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.hbs+++ b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.hbs@@ -5,7 +5,7 @@<Inputtabindex={{0}}class="filter-input"- placeholder={{this.placeholder}}+ placeholder={{this.computedPlaceholder}}autocomplete="off"autocorrect="off"autocapitalize="off"diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.jsindex 63958047f53..7284d8f8e74 100644--- a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js+++ b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js@@ -1,4 +1,3 @@-import I18n from "I18n";import SelectKitFilterComponent from "select-kit/components/select-kit/select-kit-filter";import { isEmpty } from "@ember/utils";import discourseComputed from "discourse-common/utils/decorators";@@ -9,10 +8,11 @@ export default SelectKitFilterComponent.extend({@discourseComputed("placeholder", "selectKit.hasSelection")computedPlaceholder(placeholder, hasSelection) {- if (hasSelection) {+ if (this.hidePlaceholderWithSelection && hasSelection) {return "";}- return isEmpty(placeholder) ? "" : I18n.t(placeholder);++ return isEmpty(placeholder) ? "" : placeholder;},@actiondiff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.hbs b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.hbsindex d6ffc820e8c..3bff6e9a7e3 100644--- a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.hbs+++ b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.hbs@@ -19,6 +19,7 @@this.selectKit.options.filterComponentselectKit=this.selectKitid=(concat this.selectKit.uniqueID "-filter")+ hidePlaceholderWithSelection=true}}</div>{{else}}diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 5e273dfb02b..ef0a16fe7ba 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -3900,8 +3900,6 @@ en:personal_message:title: "This topic is a personal message"help: "This topic is a personal message"- topic_edit:- tag_filter_placeholder: "+ tag"posts: "Posts"pending_posts:label: "Pending"diff --git a/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/dropdowns.hbs b/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/dropdowns.hbsindex 4167556bfa8..ea750997bbe 100644--- a/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/dropdowns.hbs+++ b/plugins/styleguide/assets/javascripts/discourse/components/sections/atoms/dropdowns.hbs@@ -138,7 +138,7 @@@value={{@dummy.selectedTags}}@options={{hashfilterable=true- filterPlaceholder="topic_edit.tag_filter_placeholder"+ filterPlaceholder="tagging.choose_for_topic"useHeaderFilter=true}}/>