Mercurial > libervia-templates
comparison sat_templates/templates/default/base/base.html @ 183:240bbac435f4
base: implemented language button:
- `component.menu` can now be used with a `{% call %}`, allowing extra HTML to be added after in the <nav> element
- a language dropdown is shown if more than one translation is available, allowing to change page locale
- if javascript is available, only the dropdown is visible, and changing it reload the page with new locale
- if javascript is not available, a submit button is display to change the locale
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 10 Apr 2019 21:05:58 +0200 |
parents | 178f55b825b7 |
children | cda2aad3eed0 |
comparison
equal
deleted
inserted
replaced
182:29214fa3a53b | 183:240bbac435f4 |
---|---|
65 {% endblock favicon %} | 65 {% endblock favicon %} |
66 </head> | 66 </head> |
67 <body> | 67 <body> |
68 {% if main_menu %} | 68 {% if main_menu %} |
69 {% block main_menu %} | 69 {% block main_menu %} |
70 {{ component.menu(main_menu, class="main_menu") }} | 70 {% call component.menu(main_menu, class="main_menu") %} |
71 <form action="" method="get" class="menu__language"> | |
72 <select name="{{C.KEY_LANG}}" id="{{C.KEY_LANG}}" onchange="this.form.submit()"> | |
73 {% if locales|length>1 %} | |
74 {% for l in locales %} | |
75 <option value="{{l}}" {{"selected" if l==locale}}> | |
76 {{l.language_name}} | |
77 </option> | |
78 {% endfor %} | |
79 {% endif %} | |
80 </select> | |
81 <button type="submit" class="menu__language-btn"> | |
82 {% trans %}change{% endtrans %} | |
83 </button> | |
84 </form> | |
85 {% endcall %} | |
71 {% endblock main_menu %} | 86 {% endblock main_menu %} |
72 {% endif %} | 87 {% endif %} |
73 | 88 |
74 <main id='main_area'> | 89 <main id='main_area'> |
75 <header> | 90 <header> |