FIX: simplifies and corrects new collection header tag/drop behaviour

This commit is contained in:
Joffrey JAFFEUX 2018-05-29 17:34:34 +02:00 committed by GitHub
parent ce687f334b
commit ee8cda691d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 12 deletions

View File

@ -7,7 +7,7 @@
category=secondCategory
parentCategory=firstCategory
categories=childCategories
subCategory="true"
subCategory=true
noSubcategories=noSubcategories}}
{{/if}}

View File

@ -20,6 +20,7 @@ export default ComboBoxComponent.extend({
fullWidthOnMobile: true,
caretDownIcon: "caret-right",
caretUpIcon: "caret-down",
subCategory: false,
init() {
this._super();
@ -50,11 +51,7 @@ export default ComboBoxComponent.extend({
collectionHeader(allCategoriesUrl, allCategoriesLabel, noCategoriesUrl, noCategoriesLabel) {
let shortcuts = "";
const currentRoute = Ember.getOwner(this)
.lookup("controller:application")
.get("currentRouteName");
if (currentRoute !== "discovery.parentCategory") {
if (this.get("hasSelection") || (this.get("noSubcategories") && this.get("subCategory"))) {
shortcuts += `
<a href="${allCategoriesUrl}" class="category-filter">
${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 += `
<a href="${noCategoriesUrl}" class="category-filter">
${noCategoriesLabel}

View File

@ -79,10 +79,6 @@ export default ComboBoxComponent.extend({
collectionHeader(allTagsUrl, allTagsLabel, noTagsUrl, noTagsLabel) {
let content = "";
const currentRoute = Ember.getOwner(this)
.lookup("controller:application")
.get("currentRouteName");
if (this.get("tagId") !== "none") {
content += `
<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 += `
<a href="${allTagsUrl}" class="tag-filter">
${allTagsLabel}