Mercurial > libervia-templates
changeset 312:6411615771b6
bulma (base): menu can now be fixed on top with `menu_fixed_top` bool variable
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Mar 2021 15:51:26 +0100 (2021-03-19) |
parents | c9396c3711e4 |
children | a8fa6e118813 |
files | sat_templates/templates/bulma/base/base.html sat_templates/templates/bulma/components/common.html |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_templates/templates/bulma/base/base.html Fri Mar 19 15:49:51 2021 +0100 +++ b/sat_templates/templates/bulma/base/base.html Fri Mar 19 15:51:26 2021 +0100 @@ -1,4 +1,12 @@ - {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} +{# base template managing common layout, blocks, links or scripts + + except for special pages, this template should always be extended. + + @variable menu_fixed_top(bool): if true, the menu will always stay on top, and padding will be added to body accordingly. +#} + + +{# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} {% set embedded = True %} {% import 'components/common.html' as component with context %} {{ script.include('common', '') }} {# common.js is, as its name states, a common script, so it's useful to import it here #} @@ -72,7 +80,7 @@ <link rel="icon" href="{{media_path}}icons/apps/64/sat.png"> {% endblock favicon %} </head> -<body{{ {'onload': body_onload} | xmlattr }}{{ ' class="body--fullscreen"'|safe if full_screen_body }}> +<body{{ {'onload': body_onload} | xmlattr }} class="{{' body--fullscreen' if full_screen_body}}{{' has-navbar-fixed-top' if menu_fixed_top}}"> {% if atom_url is defined %} {{ icon_defs('feed') }} {% endif %} @@ -91,7 +99,7 @@ {% endif %} {% if main_menu %} {% block main_menu %} - {{ component.menu(main_menu, class="main_menu") }} + {{ component.menu(main_menu) }} {% endblock main_menu %} {% endif %} {% block body_wrapper %}
--- a/sat_templates/templates/bulma/components/common.html Fri Mar 19 15:49:51 2021 +0100 +++ b/sat_templates/templates/bulma/components/common.html Fri Mar 19 15:51:26 2021 +0100 @@ -1,8 +1,8 @@ {% import 'components/menu_labels.html' as ml with context %} {# we need to use "with context" to disable cache, needed for i18n #} -{% macro menu(menus, class='') %} - <nav class="navbar has-background-primary"> +{% macro menu(menus, class='has-background-primary') %} + <nav class="navbar main_menu {{class}} {{'is-fixed-top' if menu_fixed_top}}"> <div class="navbar-brand"> <a class="navbar-item" href="/"> <img src="{{media_path}}icons/apps/64/sat.png">