# HG changeset patch # User cavaliet # Date 1360080618 -3600 # Node ID 48614929b87abc67adc16c3f0a87d3f8cb711c06 # Parent d65e05154aec72005793e87773b69983aa3abdf7 Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination. diff -r d65e05154aec -r 48614929b87a src/egonomy/static/egonomy/css/egonomy.css --- a/src/egonomy/static/egonomy/css/egonomy.css Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/static/egonomy/css/egonomy.css Tue Feb 05 17:10:18 2013 +0100 @@ -129,6 +129,10 @@ font-weight: bold; } +.right{ + float: right; +} + .main-wrap { background: #ffffff; /* Old browsers */ background: -moz-linear-gradient(top, #f0f0f0 20%, #ffffff 80%); /* FF3.6+ */ @@ -172,6 +176,9 @@ .subcol_all { float: left; margin: 2px 0 4px 10px; width: 110px; } +.subcol_all:nth-child(8n+1) { + margin-left: 0; clear: left; +} .column-third { float: left; width: 312px; @@ -205,6 +212,7 @@ margin-left: 0; clear: left; } + .column-full { margin-left: 0; width: 968px; } diff -r d65e05154aec -r 48614929b87a src/egonomy/templates/egonomy_annotate_picture.html --- a/src/egonomy/templates/egonomy_annotate_picture.html Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/templates/egonomy_annotate_picture.html Tue Feb 05 17:10:18 2013 +0100 @@ -74,15 +74,16 @@
- {% if frg.image.image %} - {% if frg.image.image|is_portrait %} - {% thumbnail frg.image.image "x110" format="PNG" crop="center" as im %} + {% with frg.image.info.image_file as image %} + {% if image %} + {% if image|is_portrait %} + {% thumbnail image "x110" format="PNG" crop="center" as im %} {% empty %} {% endthumbnail %} {% else %} - {% thumbnail frg.image.image "110" format="PNG" crop="center" as im %} + {% thumbnail image "110" format="PNG" crop="center" as im %} {% empty %} @@ -91,8 +92,9 @@ {% else %} {% endif %} + {% endwith %} - +
diff -r d65e05154aec -r 48614929b87a src/egonomy/templates/egonomy_create_fragment.html --- a/src/egonomy/templates/egonomy_create_fragment.html Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/templates/egonomy_create_fragment.html Tue Feb 05 17:10:18 2013 +0100 @@ -75,15 +75,16 @@
- {% if frg.image.image %} - {% if frg.image.image|is_portrait %} - {% thumbnail frg.image.image "x110" format="PNG" crop="center" as im %} + {% with frg.image.info.image_file as image %} + {% if image %} + {% if image|is_portrait %} + {% thumbnail image "x110" format="PNG" crop="center" as im %} {% empty %} {% endthumbnail %} {% else %} - {% thumbnail frg.image.image "110" format="PNG" crop="center" as im %} + {% thumbnail image "110" format="PNG" crop="center" as im %} {% empty %} @@ -92,8 +93,9 @@ {% else %} {% endif %} + {% endwith %} - +
diff -r d65e05154aec -r 48614929b87a src/egonomy/templates/egonomy_home.html --- a/src/egonomy/templates/egonomy_home.html Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/templates/egonomy_home.html Tue Feb 05 17:10:18 2013 +0100 @@ -19,7 +19,8 @@
-

{% if search %}{% trans "Corresponding pictures" %}{% else %}{% trans "Last annotated pictures" %}{% endif %}

+

{% if search %}{% trans "Corresponding pictures" %}{% else %}{% trans "Last annotated pictures" %}{% endif %} + {% trans "All pictures" %}

-

{{ img.metadata.titre }}

+

{{ img.metadata.titre }} : {{img.date_modif}}

{% trans "Annotated by" %} {{ img.metadata.auteur }}

{% endfor %} diff -r d65e05154aec -r 48614929b87a src/egonomy/templates/egonomy_view_fragment.html --- a/src/egonomy/templates/egonomy_view_fragment.html Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/templates/egonomy_view_fragment.html Tue Feb 05 17:10:18 2013 +0100 @@ -47,6 +47,9 @@ +
+ {% trans "Create a fragment" %} +
@@ -58,15 +61,16 @@
- {% if frg.image.image %} - {% if frg.image.image|is_portrait %} - {% thumbnail frg.image.image "x110" format="PNG" crop="center" as im %} + {% with frg.image.info.image_file as image %} + {% if image %} + {% if image|is_portrait %} + {% thumbnail image "x110" format="PNG" crop="center" as im %} {% empty %} {% endthumbnail %} {% else %} - {% thumbnail frg.image.image "110" format="PNG" crop="center" as im %} + {% thumbnail image "110" format="PNG" crop="center" as im %} {% empty %} @@ -75,8 +79,9 @@ {% else %} {% endif %} + {% endwith %} - +
diff -r d65e05154aec -r 48614929b87a src/egonomy/templates/partial/all_pictures_pagination.html --- a/src/egonomy/templates/partial/all_pictures_pagination.html Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/templates/partial/all_pictures_pagination.html Tue Feb 05 17:10:18 2013 +0100 @@ -1,7 +1,7 @@ {% if nb_pages %} {% comment %}alors ? : {{begin}} - {{middle}} - {{end}} - nb_pages = {{nb_pages}}
alors ? : nb_pages = {{nb_pages}} - range = {{nb_pages}} - cur_page_nb = {{cur_page_nb}}
{% endcomment %} - {% if 1 < cur_page_nb %}
<< {% endif %} + {% if 1 < cur_page_nb %}<< {% endif %} {% for i in begin %} {% if i == cur_page_nb %}{{i}}{% else %}{{i}}{% endif %}  {% endfor %} @@ -17,5 +17,5 @@ {% if i == cur_page_nb %}{{i}}{% else %}{{i}}{% endif %}  {% endfor %} {% endif %} - {% if cur_page_nb < nb_pages %}>>{% endif %} + {% if cur_page_nb < nb_pages %}>>{% endif %} {% endif %} \ No newline at end of file diff -r d65e05154aec -r 48614929b87a src/egonomy/views.py --- a/src/egonomy/views.py Tue Feb 05 13:16:57 2013 +0100 +++ b/src/egonomy/views.py Tue Feb 05 17:10:18 2013 +0100 @@ -3,9 +3,8 @@ from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.shortcuts import get_object_or_404, render_to_response, redirect from django.template import RequestContext -from sorl.thumbnail.images import ImageFile from models import Image, Fragment -from random import randint +from django.db.models.aggregates import Max @@ -19,11 +18,9 @@ field = "all" if "field" in request.GET: field = request.GET["field"] - - #i = randint(0, 200000) - #img_list = Image.objects.all()[i:i+12] - img_list = Image.objects.all()[:12] + + img_list = Image.objects.annotate(date_modif=Max('fragment__date_saved')).exclude(date_modif=None).order_by('-date_modif')[:12] frg_list = Fragment.objects.all().order_by('-date_saved')[:12] return render_to_response("egonomy_home.html", @@ -33,13 +30,8 @@ def annotate_picture(request, image_id): - img = get_object_or_404(Image, id=image_id) - - frg1 = {"image": img, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment X", "author":"juju"} - frg2 = {"image": img, "path":"M .1 .3 L .5 .1 L .8 .7 Z", "title":"Fragment Y", "author":"loulou"} - frg3 = {"image": img, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment Z", "author":"juju"} - frg4 = {"image": img, "path":"M .2 .5 L .7 .2 L .8 .7 Z", "title":"Fragment W", "author":"loulou"} - frg_list = [frg1,frg2,frg3,frg4,frg3,frg4,frg1,frg4,frg3,frg4,frg1,frg2] + img = get_object_or_404(Image, id=image_id) + frg_list = Fragment.objects.filter(image=img) return render_to_response("egonomy_annotate_picture.html", {'img': img, 'fragment_list': frg_list, 'image_id':image_id}, @@ -49,12 +41,7 @@ def view_fragment(request, fragment_pk): frg = get_object_or_404(Fragment, pk=fragment_pk) - - frg1 = {"image": frg.image, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment X", "author":"juju", "users_keywords":"Modernite, Ready-made"} - frg2 = {"image": frg.image, "path":"M .1 .3 L .5 .1 L .8 .7 Z", "title":"Fragment Y", "author":"loulou", "users_keywords":"Modernite, Ready-made"} - frg3 = {"image": frg.image, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment Z", "author":"juju", "users_keywords":"Modernite, Ready-made"} - frg4 = {"image": frg.image, "path":"M .2 .5 L .7 .2 L .8 .7 Z", "title":"Fragment W", "author":"loulou", "users_keywords":"Modernite, Ready-made"} - frg_list = [frg1,frg2,frg3,frg3,frg4,frg4,frg3,frg4,frg1,frg4,frg1] + frg_list = Fragment.objects.filter(image=frg.image) return render_to_response("egonomy_view_fragment.html", {'fragment': frg, 'fragment_list': frg_list}, @@ -64,13 +51,7 @@ def create_fragment(request, image_id): img = get_object_or_404(Image, id=image_id) - - frg1 = {"image": img, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment X", "author":"juju"} - frg2 = {"image": img, "path":"M .1 .3 L .5 .1 L .8 .7 Z", "title":"Fragment Y", "author":"loulou"} - frg3 = {"image": img, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment Z", "author":"juju"} - frg4 = {"image": img, "path":"M .2 .5 L .7 .2 L .8 .7 Z", "title":"Fragment W", "author":"loulou"} - frg_list = [frg1,frg2,frg3,frg4,frg3,frg4,frg1,frg4,frg3,frg4,frg1,frg2] - + frg_list = Fragment.objects.filter(image=img) return render_to_response("egonomy_create_fragment.html", {'img': img, 'fragment_list': frg_list},