Skip to content

Commit

Permalink
aggiunto template
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarzocchi84 committed Mar 18, 2020
1 parent 9604650 commit 576fcf1
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 1 deletion.
35 changes: 35 additions & 0 deletions _template/languageswitch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@


<select id="languages">
{% for lang in lizmap_locales %}
<option value="{{ lang }}" data-url="{{ lizmap_path_to_root }}../{{ lang }}/index.html" title="{{ lizmap_locales_name[lang] }}">{{ lizmap_locales_label[lang] }}</option>
{% endfor %}
</select>

<span id="versions-links">
Versions:
<span id="versions-links-list">
{% for liz_vers, liz_label, liz_link in lizmap_versions.list %}
{% if liz_vers == lizmap_versions.next_version%}
{% if version == lizmap_versions.next_version %}<strong class="verlink">{{ liz_label }}</strong>{% endif %}
{%else%}
{% if liz_vers == version %}
<strong class="verlink">{{ liz_label }}</strong>
{% else %}
<a class="verlink" href="{{ lizmap_path_to_root }}../../{{ liz_link }}/{{ language }}/" title="{{ liz_label }}">{{ liz_label }}</a>
{% endif %}{% endif %}
{% endfor %}
</span>
</span>

<script>
var currentPage = '{{current_page_name}}.html'; // coming from sphinx, always without starting '/';
var currentLang = '{{ language }}';
document.addEventListener("DOMContentLoaded", function(){
var selectLanguage = document.getElementById("languages");
selectLanguage.value = currentLang;
selectLanguage.addEventListener("change", function(event) {
window.location.href = event.target.selectedOptions[0].getAttribute('data-url');
}, false);
}, false);
</script>
79 changes: 79 additions & 0 deletions _template/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{% extends "!layout.html" %}

{% set lizmap_locales_name = {
'fr': _('French'),
'en': _('English'),
'es': _('Spanish'),
'it': _('Italian'),
'pt': _('Portuguese'),
'fi': _('Finnish'),
'ca_ES': _('Catalan'),
'da_DK': _('Danish'),
'de': _('German'),
'fa': _('Persian'),
'id': _('Indonesian'),
'ja': _('Japanese'),
'ko_KR': _('Korean'),
'nl': _('Dutch'),
'ro': _('Romanian'),
'ru': _('Russian'),
'zh_CN': _('Chinese (China)'),
'zh_TW': _('Chinese (Taiwan)')
}
%}

{% set lizmap_locales_label = {
'fr': 'Français',
'en': 'English',
'es': 'Español',
'it': 'Italiano',
'pt': 'Português',
'fi': 'Suomalainen',
'ca_ES': 'Catalan',
'da_DK': 'Dansk',
'de': 'Deutsch',
'fa': 'فارسی',
'id': 'Bahasa Indonesia',
'ja': '日本語',
'ko_KR': '한국어',
'nl': 'Nederlands',
'ro': 'Română',
'ru': 'Русский',
'zh_CN': '中文',
'zh_TW': _('Chinese (Taiwan)')
}
%}

{% set lizmap_locales = lizmap_versions.locales[version] %}
{% set lizmap_path_to_root = pathto('index')|replace('index.html','')|replace('#','') %}

{% block extrahead %}
{% for lang in lizmap_locales -%}
{% if language != lang -%}
<link href="{{ lizmap_path_to_root }}../{{ lang }}/" rel="alternate" hreflang="{{ lang }}"/>
{% endif %}
{%- endfor %}
<link href="https://docs.lizmap.com/current/{{ language }}/" rel="canonical"/>
{% endblock %}

{% block bodyheader %}
<div class="globalnav globalhead">
<a class="siteNav" href="{{ pathto(master_doc) }}" >
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" />
<span class="siteNavTitle">
Documentation
</span>
</a>
{% include "languageswitch.html" %}
</div>
{% endblock %}

{% block sidebartitle %}
<a class="sideTitle" href="{{ pathto(master_doc) }}" style="color:black">
LIZMAP
</a>
<div class="version" style="color:black">
{{ version }}
</div>
{% include "searchbox.html" %}
{% endblock %}
5 changes: 4 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
#templates_path = ['_templates']
templates_path = ['_template']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
Expand All @@ -60,6 +61,8 @@
# The master toctree document.
master_doc = 'index'



# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
Expand Down

0 comments on commit 576fcf1

Please sign in to comment.