diff options
author | Yaroslav de la Peña Smirnov <contact@yaroslavps.com> | 2018-07-15 03:17:54 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <contact@yaroslavps.com> | 2018-07-15 03:17:54 +0300 |
commit | 9046c24c4f99ec1b23f717f81ab0f42650289446 (patch) | |
tree | ddcee86a5d0625733f1caf6996588f26fdc9beb9 /weblog/templates | |
parent | c9d2bbeea44a9e691ba214d0be8566fe0d59fd77 (diff) | |
download | w3blog-9046c24c4f99ec1b23f717f81ab0f42650289446.tar.gz w3blog-9046c24c4f99ec1b23f717f81ab0f42650289446.zip |
Language selector function
Diffstat (limited to 'weblog/templates')
-rwxr-xr-x | weblog/templates/weblog/post.html | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/weblog/templates/weblog/post.html b/weblog/templates/weblog/post.html index 5a389f8..0459744 100755 --- a/weblog/templates/weblog/post.html +++ b/weblog/templates/weblog/post.html @@ -5,13 +5,13 @@ <div class="container-fluid blogpost"> <h2>{% if post_translation %}{{ post_translation.title }}{% else %}{{ post.title }}{% endif %}</h2> <p class="publish-info">{% blocktrans with publish_date=post.publish_date %}Published on {{ publish_date }}{% endblocktrans %}{% if post_author %}{% blocktrans with author=post_author context 'Written by (Author)' %}, by {{ author }}{% endblocktrans %}{% endif %}</p> - {% if languages %} + {% if post_languages %} <form> <div class="form-group"> - <label for="post-languages">{% trans 'Read in another language' %}</label> - <select class="form-control" id="post-languages" name="post-language"> + <select class="form-control" id="post-languages" name="post-language" onchange="changeLang(this.value)"> + <option disabled selected>{% trans 'Read in another language' %}</option> {% for lang in post_languages %} - <option value="{{ lang[0] }}">{{ lang[1] }}</option> + <option value="{{ lang.0 }}">{{ lang.1 }}</option> {% endfor %} </select> </div> @@ -76,5 +76,10 @@ {% endif %} {% endif %} </div> +<script> + function changeLang(lang){ + window.location = "{{ post_url }}"+lang; + } +</script> {% endblock %} |