mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: reverts combobox placeholder and introduces noneLabel
noneLabels works almost like none but instead of actually adding a row in the list, it will only change the text displayed in the header, when there's no selection.
This commit is contained in:
@@ -24,11 +24,8 @@ export default SingleSelectComponent.extend({
|
||||
|
||||
@on("didReceiveAttrs")
|
||||
_setComboBoxOptions() {
|
||||
const placeholder = this.get('placeholder');
|
||||
|
||||
this.get("headerComponentOptions").setProperties({
|
||||
clearable: this.get("clearable"),
|
||||
placeholder: placeholder ? I18n.t(placeholder) : "",
|
||||
clearable: this.get("clearable")
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,6 +7,5 @@ export default SelectKitHeaderComponent.extend({
|
||||
clearable: Ember.computed.alias("options.clearable"),
|
||||
caretUpIcon: Ember.computed.alias("options.caretUpIcon"),
|
||||
caretDownIcon: Ember.computed.alias("options.caretDownIcon"),
|
||||
shouldDisplayClearableButton: Ember.computed.and("clearable", "computedContent.hasSelection"),
|
||||
placeholder: Ember.computed.alias("options.placeholder"),
|
||||
shouldDisplayClearableButton: Ember.computed.and("clearable", "computedContent.hasSelection")
|
||||
});
|
||||
|
||||
@@ -262,7 +262,8 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixi
|
||||
|
||||
@computed("none")
|
||||
noneRowComputedContent(none) {
|
||||
if (isNone(none)) { return null; }
|
||||
if (isNone(none)) return null;
|
||||
|
||||
let noneRowComputedContent;
|
||||
|
||||
switch (typeof none) {
|
||||
|
||||
@@ -4,7 +4,7 @@ const { isEmpty, makeArray } = Ember;
|
||||
export default Ember.Component.extend({
|
||||
layoutName: "select-kit/templates/components/select-kit/select-kit-header",
|
||||
classNames: ["select-kit-header"],
|
||||
classNameBindings: ["isFocused"],
|
||||
classNameBindings: ["isFocused", "isNone"],
|
||||
attributeBindings: [
|
||||
"tabindex",
|
||||
"ariaLabel:aria-label",
|
||||
@@ -14,6 +14,8 @@ export default Ember.Component.extend({
|
||||
"name:data-name",
|
||||
],
|
||||
|
||||
isNone: Ember.computed.none("computedContent.value"),
|
||||
|
||||
ariaHasPopup: true,
|
||||
|
||||
ariaLabel: Ember.computed.or("computedContent.ariaLabel", "title"),
|
||||
|
||||
@@ -84,12 +84,18 @@ export default SelectKitComponent.extend({
|
||||
},
|
||||
|
||||
computeHeaderContent() {
|
||||
return {
|
||||
let content = {
|
||||
title: this.get("title"),
|
||||
icons: makeArray(this.getWithDefault("headerIcon", [])),
|
||||
value: this.get("selection.value"),
|
||||
name: this.get("selection.name") || this.get("noneRowComputedContent.name")
|
||||
};
|
||||
|
||||
if (!this.get("hasSelection") && this.get("noneLabel")) {
|
||||
content.title = content.name = I18n.t(this.get("noneLabel"));
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
@computed("computedAsyncContent.[]", "computedValue")
|
||||
|
||||
Reference in New Issue
Block a user