Skip to content

Commit

Permalink
Fix Twig macro _self deprecation warnings in navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
allejo committed Feb 5, 2018
1 parent 12ed65f commit 72c32d9
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions views/navbar.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% from _self import page, userOptions %}

{% macro badge(number, class) %}
<span class="c-badge {{ class }}">
{%- if number -%}
Expand All @@ -16,34 +18,35 @@
{% endmacro %}

{% macro userOptions(class) %}
{% from _self import badge, page %}
{# TODO: Don't count notifications and messages twice #}

{{ _self.page(
_self.badge(me.countUnreadNotifications, "js-counter__notifications"),
{{ page(
badge(me.countUnreadNotifications, "js-counter__notifications"),
'Notification', 'notification_list', 'bell', class, 'Notifications'
) }}
{{ _self.page(
_self.badge(me.countUnreadMessages, "js-counter__messages"),
{{ page(
badge(me.countUnreadMessages, "js-counter__messages"),
'Message', 'message_list', 'comments-o', class, 'Messages'
) }}
{{ _self.page(
{{ page(
null,
'Profile', 'profile_edit', 'gear', class, 'My Profile'
) }}
{% endmacro %}

<nav class="c-navigation" role="navigation">
<ul id="menu-pages" class="c-site_pages">
{{ _self.page('News', 'News', 'news_list', 'thumb-tack') }}
{{ _self.page('Teams', 'Team', 'team_list', 'users') }}
{{ _self.page('Players', 'Player', 'player_list', 'user') }}
{{ _self.page('Matches', 'Match', 'match_list', 'trophy') }}
{{ _self.page('Season', 'Season', 'season_show', 'calendar') }}
{{ page('News', 'News', 'news_list', 'thumb-tack') }}
{{ page('Teams', 'Team', 'team_list', 'users') }}
{{ page('Players', 'Player', 'player_list', 'user') }}
{{ page('Matches', 'Match', 'match_list', 'trophy') }}
{{ page('Season', 'Season', 'season_show', 'calendar') }}

{% if me is valid %}
<li class="u-show u-hide-sm">
<ul class="by mr-last-reset is-horizontal text-center">
{{ _self.userOptions('mr2') }}
{{ userOptions('mr2') }}
</ul>
</li>
{% endif %}
Expand All @@ -61,7 +64,7 @@

<ul class="c-user_cp">
{% if me is valid %}
{{ _self.userOptions('u-hide u-show-sm') }}
{{ userOptions('u-hide u-show-sm') }}

<li class="c-user_cp__auth">
<a href="{{ path('logout') }}">
Expand Down

0 comments on commit 72c32d9

Please sign in to comment.