comparison sat_templates/templates/bulma/components/common.html @ 397:b313a7d343af

bulma (components/common): open external menu links in blank page (new tab).
author Goffi <goffi@goffi.org>
date Thu, 30 May 2024 17:08:21 +0200
parents 11ed664a309c
children 2bbcb7da56bc
comparison
equal deleted inserted replaced
396:9847e6dbeefa 397:b313a7d343af
1 {% import 'components/menu_labels.html' as ml with context %} 1 {% import 'components/menu_labels.html' as ml with context %}
2 {# we need to use "with context" to disable cache, needed for i18n #} 2 {# We need to use "with context" to disable cache, needed for i18n. #}
3 3
4 {% macro menu(menus, class='has-background-primary') %} 4 {% macro menu(menus, class='has-background-primary') %}
5 <nav class="navbar main_menu {{class}} {{'is-fixed-top' if menu_fixed_top}}"> 5 <nav class="navbar main_menu {{class}} {{'is-fixed-top' if menu_fixed_top}}">
6 <div class="navbar-brand"> 6 <div class="navbar-brand">
7 <a class="navbar-item" href="/"> 7 <a class="navbar-item" href="/">
17 <div class="navbar-start"> 17 <div class="navbar-start">
18 {% for name, url in menus %} 18 {% for name, url in menus %}
19 <a 19 <a
20 class="navbar-item {% if name == current_page %}is-tab is-active{% endif%}" 20 class="navbar-item {% if name == current_page %}is-tab is-active{% endif%}"
21 {{ {'href': url}|xmlattr }} 21 {{ {'href': url}|xmlattr }}
22 {# External links should not replace current page. #}
23 {% if url.startswith('http:') or url.startswith('https:') -%}target="_blank"{%- endif %}
22 > 24 >
23 {{ml.label[name] or name}} 25 {{ml.label[name] or name}}
24 </a> 26 </a>
25 {% endfor %} 27 {% endfor %}
26 </div> 28 </div>