From 6b9c5843b31661562ee76ee75a360219de0397a6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 22 Oct 2014 11:53:30 +0200 Subject: [PATCH] Fixes #3393: sponsor logo on picture viewer page. --- .../templates/picture/picture_list_thumb.html | 6 ------ apps/picture/templates/picture/picture_viewer.html | 12 ++++++++++-- apps/picture/views.py | 6 ++++++ apps/wolnelektury_core/static/css/new.book.css | 5 +++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/apps/picture/templates/picture/picture_list_thumb.html b/apps/picture/templates/picture/picture_list_thumb.html index 4c2933c10..adfc25eb5 100644 --- a/apps/picture/templates/picture/picture_list_thumb.html +++ b/apps/picture/templates/picture/picture_list_thumb.html @@ -17,12 +17,6 @@ {% ssi_include 'chunk' key='picture-list' %} {% endblock %} -
- {% block book_list_logos %} - - Narodowe Centrum Kultury - {% endblock %} -
diff --git a/apps/picture/templates/picture/picture_viewer.html b/apps/picture/templates/picture/picture_viewer.html index 65b689d27..a1fb99119 100644 --- a/apps/picture/templates/picture/picture_viewer.html +++ b/apps/picture/templates/picture/picture_viewer.html @@ -42,7 +42,11 @@
  • - Narodowe Centrum Kultury + {% for sponsor in sponsors %} + {% thumbnail sponsor.logo "80x200" as logo %} + {{ sponsor.name }} + {% endthumbnail %} + {% endfor %}
  • {% endblock %} @@ -67,7 +71,11 @@
    Wolne Lektury - Narodowe Centrum Kultury + {% for sponsor in sponsors %} + {% thumbnail sponsor.logo "220x220" as logo %} + {{ sponsor.name }} + {% endthumbnail %} + {% endfor %}
    {% book_info picture %} diff --git a/apps/picture/views.py b/apps/picture/views.py index 78700d137..1f8738650 100644 --- a/apps/picture/views.py +++ b/apps/picture/views.py @@ -9,6 +9,7 @@ from django.template import RequestContext from picture.models import Picture, PictureArea from catalogue.utils import split_tags from ssify import ssi_included +from sponsors.models import Sponsor # was picture/picture_list.html list (without thumbs) def picture_list(request, filter=None, get_filter=None, template_name='catalogue/picture_list.html', cache_key=None, context=None): @@ -57,6 +58,11 @@ def picture_detail(request, slug): def picture_viewer(request, slug): picture = get_object_or_404(Picture, slug=slug) + sponsors = [] + for sponsor in picture.extra_info.get('sponsors', []): + have_sponsors = Sponsor.objects.filter(name=sponsor) + if have_sponsors.exists(): + sponsors.append(have_sponsors[0]) return render_to_response("picture/picture_viewer.html", locals(), context_instance=RequestContext(request)) diff --git a/apps/wolnelektury_core/static/css/new.book.css b/apps/wolnelektury_core/static/css/new.book.css index 45f8e5d21..a5f4c0676 100644 --- a/apps/wolnelektury_core/static/css/new.book.css +++ b/apps/wolnelektury_core/static/css/new.book.css @@ -48,6 +48,11 @@ a { margin: 1em 0 0; } +#info .sponsors img { + margin-bottom: 1em; +} + + /* =================================================== */ /* = Common elements: headings, paragraphs and lines = */ /* =================================================== */ -- 2.20.1