| 1 | {% import 'components/menu_labels.html' as ml with context %} |
| 2 | {# We need to use "with context" to disable cache, needed for i18n. #} |
| 3 | |
| 4 | {% macro menu(menus, class='is-light') %} |
| 5 | {{ icon_defs("bell", "circle-user") }} |
| 6 | {% for menu in menus %} |
| 7 | {{ icon_defs(menu.icon) }} |
| 8 | {% endfor %} |
| 9 | <nav class="navbar main_menu {{class}} {{'is-fixed-top' if menu_fixed_top}}" |
| 10 | role="navigation" aria-label="main navigation" |
| 11 | > |
| 12 | |
| 13 | <div class="navbar-brand"> |
| 14 | <a class="navbar-item" href="/"> |
| 15 | <img src="{{media_path}}icons/apps/64/sat.png"> |
| 16 | </a> |
| 17 | <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="main_menu"> |
| 18 | <span aria-hidden="true"></span> |
| 19 | <span aria-hidden="true"></span> |
| 20 | <span aria-hidden="true"></span> |
| 21 | <span aria-hidden="true"></span> |
| 22 | </a> |
| 23 | </div> |
| 24 | <div id="main_menu" class="navbar-menu"> |
| 25 | <div class="navbar-start"> |
| 26 | {% for menu in menus %} |
| 27 | <a |
| 28 | class="navbar-item {% if menu.name == current_page %}is-tab is-active{% endif%}" |
| 29 | {{ {'href': menu.url}|xmlattr }} |
| 30 | {# External links should not replace current page. #} |
| 31 | {% if menu.url.startswith('http:') or menu.url.startswith('https:') -%}target="_blank"{%- endif %} |
| 32 | > |
| 33 | <span class="icon">{{ icon(menu.icon) }}</span> |
| 34 | <span class="menu-item">{{ml.label[menu.name] or menu.name}}</span> |
| 35 | </a> |
| 36 | {% endfor %} |
| 37 | </div> |
| 38 | <div class="navbar-end"> |
| 39 | <div class="navbar-item has-dropdown is-hoverable"> |
| 40 | <span class="menu-item navbar-link"><span class="menu-item">{{locale.language_name}}</span></span> |
| 41 | <div class="navbar-dropdown"> |
| 42 | {% for l in locales|reject("eq", locale) %} |
| 43 | <a class="navbar-item" href="?{{C.KEY_LANG}}={{l}}">{{l.language_name}}</a> |
| 44 | {% endfor %} |
| 45 | </div> |
| 46 | |
| 47 | </div> |
| 48 | <div class="navbar-item" id="menu_notifs"> |
| 49 | <div class="buttons"> |
| 50 | <a class="button is-light"> |
| 51 | <span class="icon">{{ icon("bell") }}</span> |
| 52 | <span class="tag is-danger has-text-white menu-item">3</span> |
| 53 | </a> |
| 54 | <a {{ {'href': login_url}|xmlattr }}> |
| 55 | {% if profile %} |
| 56 | <div class="button is-light"> |
| 57 | <span class="icon">{{ icon("circle-user") }}</span> |
| 58 | <span class="menu-item">{{profile}}</span> |
| 59 | </div> |
| 60 | {% else %} |
| 61 | <div class="button is-light"> |
| 62 | <span class="menu-item">Log In</span> |
| 63 | </div> |
| 64 | {% endif %} |
| 65 | </a> |
| 66 | </div> |
| 67 | </div> |
| 68 | </div> |
| 69 | </div> |
| 70 | </nav> |
| 71 | {% endmacro %} |
| 72 | |
| 73 | {% macro action_button(url, label=_("create"), icon="plus-circled", class="is-primary is-rounded", id=none) %} |
| 74 | <a class="button {{class}}" {{ {"href":url, "id": id} | xmlattr }}><i class="icon-{{icon}}"></i> {{label}}</a> |
| 75 | {% endmacro %} |