fix the function to filter lang.

This commit is contained in:
Alexis Métaireau 2012-10-09 11:56:52 +02:00
parent 3ee5ee2be8
commit 4492002860
3 changed files with 28 additions and 6 deletions

View file

@ -10,3 +10,5 @@ GITHUB_URL = "http://github.com/ametaireau/"
TIMEZONE = "Europe/Paris"
LOCALE = "en_US.utf8"
DEFAULT_DATE_FORMAT = ('%B %Y')

View file

@ -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

View file

@ -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 %}
<section id="content" class="body">
<div id="lang-selector">filter by language: <a href="#" lang='en'>english</a>, <a href="#" lang='fr'>french</a></div>
<div id="lang-selector"><a href="#" lang='en'>english</a> <a href="#" lang='fr'>french</a></div>
<ol id="posts-list" class="hfeed">
{% set category = None %}
{% for article in articles_page.object_list %}