mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: show none/all on cat/tag drop only when needed
This commit is contained in:
parent
597095f56f
commit
a8079ab679
@ -50,13 +50,19 @@ export default ComboBoxComponent.extend({
|
||||
collectionHeader(allCategoriesUrl, allCategoriesLabel, noCategoriesUrl, noCategoriesLabel) {
|
||||
let shortcuts = "";
|
||||
|
||||
shortcuts += `
|
||||
<a href="${allCategoriesUrl}" class="category-filter">
|
||||
${allCategoriesLabel}
|
||||
</a>
|
||||
`;
|
||||
const currentRoute = Ember.getOwner(this)
|
||||
.lookup("controller:application")
|
||||
.get("currentRouteName");
|
||||
|
||||
if (this.get("subCategory")) {
|
||||
if (currentRoute !== "discovery.parentCategory") {
|
||||
shortcuts += `
|
||||
<a href="${allCategoriesUrl}" class="category-filter">
|
||||
${allCategoriesLabel}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
if (this.get("subCategory") && currentRoute !== "discovery.categoryNone") {
|
||||
shortcuts += `
|
||||
<a href="${noCategoriesUrl}" class="category-filter">
|
||||
${noCategoriesLabel}
|
||||
|
@ -77,14 +77,29 @@ export default ComboBoxComponent.extend({
|
||||
|
||||
@computed("allTagsUrl", "allTagsLabel", "noTagsUrl", "noTagsLabel")
|
||||
collectionHeader(allTagsUrl, allTagsLabel, noTagsUrl, noTagsLabel) {
|
||||
return `
|
||||
<a href="${allTagsUrl}" class="tag-filter">
|
||||
${allTagsLabel}
|
||||
</a>
|
||||
<a href="${noTagsUrl}" class="tag-filter">
|
||||
${noTagsLabel}
|
||||
</a>
|
||||
`;
|
||||
let content = "";
|
||||
|
||||
const currentRoute = Ember.getOwner(this)
|
||||
.lookup("controller:application")
|
||||
.get("currentRouteName");
|
||||
|
||||
if (this.get("tagId") !== "none") {
|
||||
content += `
|
||||
<a href="${noTagsUrl}" class="tag-filter">
|
||||
${noTagsLabel}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
if (currentRoute === "tags.showCategory") {
|
||||
content += `
|
||||
<a href="${allTagsUrl}" class="tag-filter">
|
||||
${allTagsLabel}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
@computed("tag")
|
||||
|
Loading…
Reference in New Issue
Block a user