aboutsummaryrefslogtreecommitdiff
path: root/weblog
diff options
context:
space:
mode:
Diffstat (limited to 'weblog')
-rwxr-xr-xweblog/static/weblog/js/weblog.js2
-rwxr-xr-xweblog/templates/weblog/post.html13
-rwxr-xr-xweblog/views.py1
3 files changed, 11 insertions, 5 deletions
diff --git a/weblog/static/weblog/js/weblog.js b/weblog/static/weblog/js/weblog.js
index b802841..164cc3b 100755
--- a/weblog/static/weblog/js/weblog.js
+++ b/weblog/static/weblog/js/weblog.js
@@ -10,4 +10,4 @@ function toggleNode(caller){
$(caller).attr('node-state', 'closed');
}
$('#'+target).toggle();
-} \ No newline at end of file
+}
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 %}
diff --git a/weblog/views.py b/weblog/views.py
index 922e8c5..95558fc 100755
--- a/weblog/views.py
+++ b/weblog/views.py
@@ -159,6 +159,7 @@ def PostView(request, category_slug, post_slug, language=None):
post = get_object_or_404(BlogPost, slug=post_slug)
context_dict = blog_settings.copy()
context_dict['comment_form'] = PostCommentForm()
+ context_dict['post_url'] = post.get_absolute_url()
post_translations = Translation.objects.filter(post=post)
category = None
current_language = translation.get_language()