mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: simplifies and corrects new collection header tag/drop behaviour
This commit is contained in:
parent
ce687f334b
commit
ee8cda691d
3 changed files with 5 additions and 12 deletions
|
@ -7,7 +7,7 @@
|
||||||
category=secondCategory
|
category=secondCategory
|
||||||
parentCategory=firstCategory
|
parentCategory=firstCategory
|
||||||
categories=childCategories
|
categories=childCategories
|
||||||
subCategory="true"
|
subCategory=true
|
||||||
noSubcategories=noSubcategories}}
|
noSubcategories=noSubcategories}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ export default ComboBoxComponent.extend({
|
||||||
fullWidthOnMobile: true,
|
fullWidthOnMobile: true,
|
||||||
caretDownIcon: "caret-right",
|
caretDownIcon: "caret-right",
|
||||||
caretUpIcon: "caret-down",
|
caretUpIcon: "caret-down",
|
||||||
|
subCategory: false,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super();
|
this._super();
|
||||||
|
@ -50,11 +51,7 @@ export default ComboBoxComponent.extend({
|
||||||
collectionHeader(allCategoriesUrl, allCategoriesLabel, noCategoriesUrl, noCategoriesLabel) {
|
collectionHeader(allCategoriesUrl, allCategoriesLabel, noCategoriesUrl, noCategoriesLabel) {
|
||||||
let shortcuts = "";
|
let shortcuts = "";
|
||||||
|
|
||||||
const currentRoute = Ember.getOwner(this)
|
if (this.get("hasSelection") || (this.get("noSubcategories") && this.get("subCategory"))) {
|
||||||
.lookup("controller:application")
|
|
||||||
.get("currentRouteName");
|
|
||||||
|
|
||||||
if (currentRoute !== "discovery.parentCategory") {
|
|
||||||
shortcuts += `
|
shortcuts += `
|
||||||
<a href="${allCategoriesUrl}" class="category-filter">
|
<a href="${allCategoriesUrl}" class="category-filter">
|
||||||
${allCategoriesLabel}
|
${allCategoriesLabel}
|
||||||
|
@ -62,7 +59,7 @@ export default ComboBoxComponent.extend({
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.get("subCategory") && currentRoute !== "discovery.categoryNone") {
|
if (this.get("subCategory") && (this.get("hasSelection") || !this.get("noSubcategories"))) {
|
||||||
shortcuts += `
|
shortcuts += `
|
||||||
<a href="${noCategoriesUrl}" class="category-filter">
|
<a href="${noCategoriesUrl}" class="category-filter">
|
||||||
${noCategoriesLabel}
|
${noCategoriesLabel}
|
||||||
|
|
|
@ -79,10 +79,6 @@ export default ComboBoxComponent.extend({
|
||||||
collectionHeader(allTagsUrl, allTagsLabel, noTagsUrl, noTagsLabel) {
|
collectionHeader(allTagsUrl, allTagsLabel, noTagsUrl, noTagsLabel) {
|
||||||
let content = "";
|
let content = "";
|
||||||
|
|
||||||
const currentRoute = Ember.getOwner(this)
|
|
||||||
.lookup("controller:application")
|
|
||||||
.get("currentRouteName");
|
|
||||||
|
|
||||||
if (this.get("tagId") !== "none") {
|
if (this.get("tagId") !== "none") {
|
||||||
content += `
|
content += `
|
||||||
<a href="${noTagsUrl}" class="tag-filter">
|
<a href="${noTagsUrl}" class="tag-filter">
|
||||||
|
@ -91,7 +87,7 @@ export default ComboBoxComponent.extend({
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentRoute === "tags.showCategory") {
|
if (this.get("hasSelection") || this.get("tagId") === "none") {
|
||||||
content += `
|
content += `
|
||||||
<a href="${allTagsUrl}" class="tag-filter">
|
<a href="${allTagsUrl}" class="tag-filter">
|
||||||
${allTagsLabel}
|
${allTagsLabel}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue