Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
fix badges container in menu (#167)
Browse files Browse the repository at this point in the history
Co-authored-by: Remy Keignart <[email protected]>
Co-authored-by: Kevin Papst <[email protected]>
  • Loading branch information
3 people authored Oct 5, 2021
1 parent 139cc55 commit 8b06c35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Resources/views/Macros/menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<a href="{{ item.hasChildren ? '#': '/' in item.route ? item.route : path(item.route|route_alias, item.routeArgs) }}">
{% if item.icon %} <i class="{{ item.icon }}"></i> {% endif %}
{% if item.badge is not same as(false) %}
<span class="pull-right-container">
<small class="label pull-right bg-{{ item.badgeColor }}">{{ item.badge }}</small>
</span>
{% endif %}
{% if item.hasChildren %}<i class="fas fa-angle-left pull-right"></i>{% endif %}
<span>{{ item.label|trans }}</span>
Expand Down Expand Up @@ -38,6 +40,8 @@
<i class="{{ item.icon|default(defaultIcon) }}"></i>
<span>{{ item.label|trans }}</span>
{% if item.badge is not same as(false) %}
<span class="pull-right-container">
<small class="label pull-right bg-{{ item.badgeColor }}">{{ item.badge }}</small>
</span>
{% endif %}
{% endmacro %}
12 changes: 8 additions & 4 deletions Resources/views/Partials/_menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
{% macro badges(item) %}
{% import _self as selfMacros %}
{% if item.getExtra('badge') is not null %}
{{ selfMacros.badge(item.getExtra('badge')) }}
<span class="pull-right-container">
{{ selfMacros.badge(item.getExtra('badge')) }}
</span>
{% elseif item.getExtra('badges') is not null %}
{% for badge in item.getExtra('badges') %}
{{ selfMacros.badge(badge) }}
{% endfor %}
<span class="pull-right-container">
{% for badge in item.getExtra('badges') %}
{{ selfMacros.badge(badge) }}
{% endfor %}
</span>
{% endif %}
{% endmacro %}

Expand Down

0 comments on commit 8b06c35

Please sign in to comment.