blog.notmyidea.org/theme/templates/index.html

76 lines
3 KiB
HTML

{% extends "base.html" %}
{% block content_title %}{% endblock %}
{% block js %}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script language="javascript">
$(document).ready(function(){
var cat = '';
$('#lang-selector a').each(function(i, item){
$(item).click(function(){
$('#posts-list a[class="' + item.lang + '"]').each(function(i, article){
$(article).show();
var catDiv = $($(article).find('span[class*="category"]'))[0];
if (catDiv != undefined){
console.log(catDiv.innerText);
console.log(cat);
if (catDiv.innerText == cat){
$(catDiv).hide();
}
cat = catDiv.innerText;
}
});
$('#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;
});
});
});
</script>
{% endblock %}
{% block content %}
{% if articles %}
<section id="content" class="body">
{% if category and category.name == 'notes' %}
<p><em>Voici quelques notes, probablement prises à la va-vite dans un train alors que je visualisais un documentaire / écoutait une émission ou lisait un texte. Ces notes sont susceptibles d'évoluer, prenez les tel quel!</em></p>
{% else %}
<div id="lang-selector">filter by language: <a href="#" lang='en'>english</a> <a href="#" lang='fr'>french</a></div>
{% endif %}
<ol id="posts-list" class="hfeed">
{% set current_category = None %}
{% for article in articles_page.object_list %}
{% if article.category.name != 'notes' or category and category.name == 'notes' %}
<a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" title="{{ article.title}}" class='{{ article.lang }}'>
<li><article class="hentry {{ article.category }}">
{% if article.category.name != current_category %}
<span class='category {{ article.category }}'>{{ article.category }}</span>
{% set current_category = article.category.name %}
{% endif %}
<h1> {% if article.category == 'notes' %} Notes: {% endif %} {{ article.title }} </h1>
</article></li>
</a>
{% endif %}
{% endfor %}
</ol><!-- /#posts-list -->
</section><!-- /#content -->
{% else %}
<section id="content" class="body">
<h2>Pages</h2>
{% for page in PAGES %}
<li><a href="{{ SITEURL }}/{{ page.url }}">{{ page.title }}</a></li>
{% endfor %}
</section>
{% endif %}
{% endblock content %}