Skip to content

Commit

Permalink
templates: use current_menu instead of menu
Browse files Browse the repository at this point in the history
* flask-menu adds current_menu as a context_processor

* the current_ is a convention on jinja templates
  • Loading branch information
utnapischtim committed Jul 6, 2023
1 parent 78ade11 commit 9ab59c9
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions invenio_theme/templates/invenio_theme/admin_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<span class="icon-bar"></span>
</a>
<ul class="nav navbar-nav">
{%- for item in menu.submenu('main').children if item.visible recursive %}
{%- for item in current_menu.submenu('main').children if item.visible recursive %}
{%- if item.children -%}
<li class="dropdown">.
<a href="{{ item.url }}" style="display: inline-block; padding-right: 5px;"> {{ item.text|safe }} </a>
Expand Down Expand Up @@ -63,7 +63,7 @@
</div>
</div>
</li>
{%- for item in menu.submenu('settings').children if item.visible %}
{%- for item in current_menu.submenu('settings').children if item.visible %}
{% if loop.first %}<li class="divider"></li>{% endif -%}
<li><a href="{{ item.url }}">{{ item.text|safe }}</a></li>
{%- endfor %}
Expand Down
2 changes: 1 addition & 1 deletion invenio_theme/templates/invenio_theme/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{%- endblock navbar_search %}
{%- endif %}
<ul class="nav navbar-nav">
{%- for item in menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
{%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
{%- if item.children %}
<li class="dropdown{{ ' active' if item.active else ''}}">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" href="{{ item.url }}">{{ item.text|safe }} <b class="caret"></b></a>
Expand Down
2 changes: 1 addition & 1 deletion invenio_theme/templates/invenio_theme/header_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
{%- for item in menu.submenu('settings').children if item.visible %}
{%- for item in current_menu.submenu('settings').children if item.visible %}
<li><a href="{{ item.url }}">{{ item.text|safe }}</a></li>
{%- endfor %}
<li class="divider"></li>
Expand Down
2 changes: 1 addition & 1 deletion invenio_theme/templates/invenio_theme/page_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>{{ _('Settings') }}</strong></div>
<ul class="list-group">
{%- for item in menu.submenu('settings').children if item.visible %}
{%- for item in current_menu.submenu('settings').children if item.visible %}
{%- block settings_menu_item scoped %}
<a href="{{ item.url }}" class="list-group-item{% if item.active %} active{% endif %}">
{{ item.text|safe }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<span class="icon-bar"></span>
</a>
<ul class="nav navbar-nav">
{%- for item in menu.submenu('main').children if item.visible recursive %}
{%- for item in current_menu.submenu('main').children if item.visible recursive %}
{%- if item.children -%}
<li class="dropdown">.
<a href="{{ item.url }}" style="display: inline-block; padding-right: 5px;"> {{ item.text|safe }} </a>
Expand Down Expand Up @@ -63,7 +63,7 @@
</div>
</div>
</li>
{%- for item in menu.submenu('settings').children if item.visible %}
{%- for item in current_menu.submenu('settings').children if item.visible %}
{% if loop.first %}<li class="divider"></li>{% endif -%}
<li><a href="{{ item.url }}">{{ item.text|safe }}</a></li>
{%- endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{%- endblock navbar_search %}
{%- endif %}
</li>
{%- for item in menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
{%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
{%- if item.children %}
<li class="navbar-item navbar-options">
<div class="dropdown{{ ' active' if item.active else '' }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div class="ui dropdown icon button floating">
<i class="dropdown icon"></i>
<div class="menu">
{%- for item in menu.submenu('settings').children if item.visible %}
{%- for item in current_menu.submenu('settings').children if item.visible %}
<a class="item"
style="color:black;"
href="{{ item.url }}">{{ item.text|safe }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 class="ui header">{{ _("My account") }}</h1>
{%- block settings_menu scoped %}
<div class="ui vertical menu fluid">
<strong class="header item">{{ _('Settings') }}</strong>
{%- for item in menu.submenu('settings').children if item.visible %}
{%- for item in current_menu.submenu('settings').children if item.visible %}

{%- block settings_menu_item scoped %}
<a href="{{ item.url }}" class="brand item{% if item.active %} active{% endif %}">
Expand Down

0 comments on commit 9ab59c9

Please sign in to comment.