homepage work + forgotten migration for change in models.py (replacing description charfield 255 with a textfield
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/iconolab/migrations/0010_auto_20160816_1242.py Tue Aug 16 15:39:00 2016 +0200
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-08-16 12:42
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('iconolab', '0009_auto_20160812_1417'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='collection',
+ name='description',
+ field=models.TextField(null=True),
+ ),
+ ]
--- a/src/iconolab/templates/iconolab/home.html Tue Aug 16 14:50:28 2016 +0200
+++ b/src/iconolab/templates/iconolab/home.html Tue Aug 16 15:39:00 2016 +0200
@@ -8,11 +8,45 @@
{% block content %}
{% for collection in collections.all %}
-<h1>Fond {{ collection.verbose_name }} <a href="{% url 'collection_home' collection.name %}"><span class="glyphicon glyphicon-link" aria-hidden="true"></span></a></h1>
+<div id="collection-panel-{{collection.name}}" class="container collection-container panel panel-default {% if forloop.first %}selected{% endif %}" style="padding-top: 15px; padding-bottom: 15px;">
+ <div class="row">
+ <div class="col-md-4">
+ {% thumbnail collection.image "350x350" crop=False as im %}
+ <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
+ {% endthumbnail %}
+ </div>
+ <div class="col-md-8">
+ <h1 class="collection-title" style="margin-top:0px;"><small>Fond Iconolab</small> {{ collection.verbose_name }}</h1>
+ <p class="text-justify"> {{collection.description | safe}} </p>
+ <a href="{% url 'collection_home' collection.name %}" class="btn btn-default btn-sm">Contribuer au fond {{collection.verbose_name}}</a>
+ </div>
+ </div>
+</div>
{% endfor %}
+<div class="collection-navbar text-center">
+ <h4>Les autres fonds dans Iconolab</h4>
+ <ul class="list-inline list-unstyled">
+ {% for collection in collections.all %}
+ <li><div id="show-collection-{{collection.name}}" class="btn btn-default btn-xs {% if forloop.first %}btn-primary{% endif %} btn-collection">{{collection.verbose_name}}</div></li>
+ {% endfor %}
+ </ul>
+</div>
+{% endblock %}
-{% get_current_language as LANGUAGE_CODE %}
-{% get_available_languages as LANGUAGES %}
-{% get_current_language_bidi as LANGUAGE_BIDI %}
-the current language is {{ LANGUAGE_CODE }}
+{% block footer_js %}
+<script>
+ $(".collection-container:not(.selected)").hide();
+ var selectedID = /collection\-panel\-([0-9a-z\-]+)/.exec($(".collection-container.selected").attr("id"))[1];
+ $(".btn-collection").on("click", function(e){
+ selectedID = /show\-collection\-([0-9a-z\-]+)/.exec($(this).attr("id"))[1];
+ if (!$(this).hasClass("btn-primary")){
+ $(".collection-container").removeClass("selected");
+ $(".collection-container:not(.selected)").hide();
+ $(".btn-collection").removeClass("btn-primary")
+ $(this).addClass("btn-primary")
+ $(".collection-container#collection-panel-"+selectedID).show()
+ $(".collection-container#collection-panel-"+selectedID).addClass("selected")
+ }
+ })
+</script>
{% endblock %}
\ No newline at end of file