Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass missing isEmptyCategoryFilterValueVisible and add condition #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,43 @@
{% set quantity = filterValue.docCount %}
{% endfor %}

{% if data.filterPath is not empty %}
{% set currentUrl = url(data.filterPath, {categoryPath: (app.request.attributes.get('categoryPath'))}) %}
{% else %}
{% set currentUrl = app.request.attributes.get('categoryNode') ? app.request.attributes.get('categoryNode').url : null %}
{% endif %}
{% if (quantity > 0) or (quantity <= 0 and data.isEmptyCategoryFilterValueVisible == true) %}

{% set categoryUrl = data.filterPath is not empty ? url(data.filterPath, {categoryPath: (categoryNode.url | trimLocale)}) : categoryNode.url %}
{% set isActive = (currentUrl == categoryUrl) %}
{% set isHidden = (data.levelMenu != 1) %}
{% set disableAttribute = quantity == 0 ? 'disabled' %}
{% set menuItemActiveClass = isActive ? config.name ~ '__menu-item--active ' ~ config.jsName ~ '__menu-item' %}
{% set menuItemHiddenClass = isHidden and not isActive ? 'is-hidden-lg-xxl' %}
{% set menuLinkActiveClass = isActive ? config.name ~ '__menu-link--active' %}
{% set linkTextActiveClass = isActive ? config.name ~ '__link-text--active' %}
{% set triggerButtonJsName = data.parentJsName ? data.parentJsName ~ '__trigger' %}
{% if data.filterPath is not empty %}
{% set currentUrl = url(data.filterPath, {categoryPath: (app.request.attributes.get('categoryPath'))}) %}
{% else %}
{% set currentUrl = app.request.attributes.get('categoryNode') ? app.request.attributes.get('categoryNode').url : null %}
{% endif %}

<li class="{{ config.name }}__menu-item {{ config.name }}__menu-item--lvl-{{ data.levelMenu }} {{ menuItemActiveClass }} {{ menuItemHiddenClass }}">
<button class="{{ config.name }}__menu-link {{ config.name }}__menu-link--lvl-{{ data.levelMenu }} {{ menuLinkActiveClass }} {{ triggerButtonJsName }}" type="button" {{ disableAttribute }} data-url={{ categoryUrl }}>
<span class="{{ config.name }}__link-text {{ linkTextActiveClass }}">{{ categoryNode.name }}</span> <span>{{ quantity }}</span>
</button>
{% set categoryUrl = data.filterPath is not empty ? url(data.filterPath, {categoryPath: (categoryNode.url | trimLocale)}) : categoryNode.url %}
{% set isActive = (currentUrl == categoryUrl) %}
{% set isHidden = (data.levelMenu != 1) %}
{% set disableAttribute = quantity == 0 ? 'disabled' %}
{% set menuItemActiveClass = isActive ? config.name ~ '__menu-item--active ' ~ config.jsName ~ '__menu-item' %}
{% set menuItemHiddenClass = isHidden and not isActive ? 'is-hidden-lg-xxl' %}
{% set menuLinkActiveClass = isActive ? config.name ~ '__menu-link--active' %}
{% set linkTextActiveClass = isActive ? config.name ~ '__link-text--active' %}
{% set triggerButtonJsName = data.parentJsName ? data.parentJsName ~ '__trigger' %}

{% if hasChildren %}
{% include molecule('filter-category', 'CatalogPage') with {
data: {
filter: data.filter,
filterPath: data.filterPath,
categories: categoryNode.children,
levelMenu: data.levelMenu + 1,
parentJsName: data.parentJsName,
},
} only %}
{% endif %}
</li>
<li class="{{ config.name }}__menu-item {{ config.name }}__menu-item--lvl-{{ data.levelMenu }} {{ menuItemActiveClass }} {{ menuItemHiddenClass }}">
<button class="{{ config.name }}__menu-link {{ config.name }}__menu-link--lvl-{{ data.levelMenu }} {{ menuLinkActiveClass }} {{ triggerButtonJsName }}" type="button" {{ disableAttribute }} data-url={{ categoryUrl }}>
<span class="{{ config.name }}__link-text {{ linkTextActiveClass }}">{{ categoryNode.name }}</span> <span>{{ quantity }}</span>
</button>

{% if hasChildren %}
{% include molecule('filter-category', 'CatalogPage') with {
data: {
filter: data.filter,
filterPath: data.filterPath,
categories: categoryNode.children,
levelMenu: data.levelMenu + 1,
isEmptyCategoryFilterValueVisible: data.isEmptyCategoryFilterValueVisible,
parentJsName: data.parentJsName,
},
} only %}
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
facets: data.facets,
filterPath: data.filterPath,
categories: data.categories,
isEmptyCategoryFilterValueVisible: data.isEmptyCategoryFilterValueVisible,
parentJsName: catalogJsName,
},
} only %}
Expand Down