mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
UX: Minor change to compact tag chooser (#22796)
Followup to f5e8e73. This switches the placeholder label to the existing string "optional tags" and only shows it if there are no items picked. Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
@ -72,7 +72,7 @@
|
||||
filterable=true
|
||||
categoryId=this.buffered.category_id
|
||||
minimum=this.minimumRequiredTags
|
||||
filterPlaceholder="topic_edit.tag_filter_placeholder"
|
||||
filterPlaceholder="tagging.choose_for_topic"
|
||||
useHeaderFilter=true
|
||||
}}
|
||||
/>
|
||||
|
@ -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"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -5,7 +5,7 @@
|
||||
<Input
|
||||
tabindex={{0}}
|
||||
class="filter-input"
|
||||
placeholder={{this.placeholder}}
|
||||
placeholder={{this.computedPlaceholder}}
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
|
@ -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;
|
||||
},
|
||||
|
||||
@action
|
||||
|
@ -19,6 +19,7 @@
|
||||
this.selectKit.options.filterComponent
|
||||
selectKit=this.selectKit
|
||||
id=(concat this.selectKit.uniqueID "-filter")
|
||||
hidePlaceholderWithSelection=true
|
||||
}}
|
||||
</div>
|
||||
{{else}}
|
||||
|
@ -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"
|
||||
|
@ -138,7 +138,7 @@
|
||||
@value={{@dummy.selectedTags}}
|
||||
@options={{hash
|
||||
filterable=true
|
||||
filterPlaceholder="topic_edit.tag_filter_placeholder"
|
||||
filterPlaceholder="tagging.choose_for_topic"
|
||||
useHeaderFilter=true
|
||||
}}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user