From 4492002860f1e548217df1ff74b7138a88a0f6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 9 Oct 2012 11:56:52 +0200 Subject: [PATCH] fix the function to filter lang. --- pelican.conf.py | 2 ++ theme/static/css/main.css | 14 ++++++++++++-- theme/templates/index.html | 18 ++++++++++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pelican.conf.py b/pelican.conf.py index a61161e..81b21b8 100644 --- a/pelican.conf.py +++ b/pelican.conf.py @@ -10,3 +10,5 @@ GITHUB_URL = "http://github.com/ametaireau/" TIMEZONE = "Europe/Paris" LOCALE = "en_US.utf8" + +DEFAULT_DATE_FORMAT = ('%B %Y') diff --git a/theme/static/css/main.css b/theme/static/css/main.css index f896462..60b8c8b 100644 --- a/theme/static/css/main.css +++ b/theme/static/css/main.css @@ -264,8 +264,18 @@ img.left, figure.left {float: right; margin: 0 0 2em 2em;} color: #bbb; } -#lang-selector a{ color: #bbb; } -#lang-selector a.deactivated { text-decoration: none; } +#lang-selector a { + color: #bbb; + text-decoration: none; + padding: 2px 5px; + border-radius: 4px; +} + +#lang-selector a.activated { + text-decoration: none; + background-color: #bbb; + color: #fff +} /* Extras diff --git a/theme/templates/index.html b/theme/templates/index.html index 7c9558f..9d64150 100644 --- a/theme/templates/index.html +++ b/theme/templates/index.html @@ -7,10 +7,20 @@ $(document).ready(function(){ $('#lang-selector a').each(function(i, item){ $(item).click(function(){ - $(item).toggleClass('deactivated'); - $('a[class="' + item.lang +'"]').each(function(i, article){ - $(article).toggle(); + $('#posts-list a[class="' + item.lang + '"]').each(function(i, article){ + $(article).show(); + }); + + $('#posts-list a[class!="' + item.lang + '"]').each(function(i, article){ + $(article).hide(); + }); + + // set this link as activated and all the other ones as deactivated + $(item).addClass('activated'); + + $('#lang-selector a[lang!="' + item.lang + '"]').each(function(i, otherLink){ + $(otherLink).removeClass('activated'); }); return false; @@ -23,7 +33,7 @@ {% block content %} {% if articles %}
-
filter by language: english, french
+
    {% set category = None %} {% for article in articles_page.object_list %}