mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: improves uncategorized support for category-select-box
This commit is contained in:
@@ -7,6 +7,8 @@ import Category from "discourse/models/category";
|
||||
export default SelectBoxComponent.extend({
|
||||
classNames: ["category-select-box"],
|
||||
|
||||
selectBoxRowComponent: "category-select-box/category-select-box-row",
|
||||
|
||||
textKey: "name",
|
||||
|
||||
filterable: true,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import SelectBoxRowComponent from "discourse/components/select-box/select-box-row";
|
||||
import Category from "discourse/models/category";
|
||||
|
||||
export default SelectBoxRowComponent.extend({
|
||||
classNameBindings: ["isUncategorized"],
|
||||
|
||||
@computed("content")
|
||||
isUncategorized(content) {
|
||||
const category = Category.findById(content.id);
|
||||
return category.get("isUncategorizedCategory");
|
||||
}
|
||||
});
|
||||
@@ -5,29 +5,16 @@ export default Ember.Component.extend({
|
||||
|
||||
classNameBindings: ["focused:is-focused"],
|
||||
|
||||
showClearButton: false,
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super();
|
||||
|
||||
this._setCaretIcon();
|
||||
},
|
||||
|
||||
@computed("clearable", "selectedId")
|
||||
showClearButton(clearable, selectedId) {
|
||||
return clearable === true && !Ember.isNone(selectedId);
|
||||
},
|
||||
|
||||
click() {
|
||||
this.sendAction("onToggle");
|
||||
},
|
||||
|
||||
actions: {
|
||||
clearSelection() {
|
||||
this.sendAction("onClearSelection");
|
||||
}
|
||||
},
|
||||
|
||||
_setCaretIcon() {
|
||||
if(this.get("expanded")) {
|
||||
this.set("caretIcon", this.get("caretUpIcon"));
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
caretUpIcon=caretUpIcon
|
||||
caretDownIcon=caretDownIcon
|
||||
onToggle=(action "onToggle")
|
||||
onClearSelection=(action "onClearSelection")
|
||||
icon=icon
|
||||
clearable=clearable
|
||||
expanded=expanded
|
||||
value=value
|
||||
}}
|
||||
|
||||
@@ -6,10 +6,4 @@
|
||||
{{text}}
|
||||
</span>
|
||||
|
||||
{{#if showClearButton}}
|
||||
<button class="btn btn-primary clear-selection" {{action "clearSelection" bubbles=false}}>
|
||||
{{d-icon "times"}}
|
||||
</button>
|
||||
{{/if}}
|
||||
|
||||
{{d-icon caretIcon class="caret-icon"}}
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
|
||||
&.is-uncategorized {
|
||||
.topic-count {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-count {
|
||||
font-size: 11px;
|
||||
color: $primary;
|
||||
|
||||
@@ -91,18 +91,6 @@
|
||||
-webkit-box-shadow: $tertiary 0px 0px 6px 0px;
|
||||
box-shadow: $tertiary 0px 0px 6px 0px;
|
||||
}
|
||||
|
||||
.clear-selection {
|
||||
margin: 0 5px;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
|
||||
.d-icon {
|
||||
margin: 0;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.select-box-body {
|
||||
|
||||
Reference in New Issue
Block a user