FIX: show none/all on cat/tag drop only when needed

This commit is contained in:
Joffrey JAFFEUX 2018-05-29 16:08:31 +02:00 committed by GitHub
parent 597095f56f
commit a8079ab679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 14 deletions

View File

@ -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}

View File

@ -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")