Fixes #3393: sponsor logo on picture viewer page.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Wed, 22 Oct 2014 09:53:30 +0000 (11:53 +0200)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Wed, 22 Oct 2014 09:53:30 +0000 (11:53 +0200)
apps/picture/templates/picture/picture_list_thumb.html
apps/picture/templates/picture/picture_viewer.html
apps/picture/views.py
apps/wolnelektury_core/static/css/new.book.css

index 4c2933c..adfc25e 100644 (file)
             {% ssi_include 'chunk' key='picture-list' %}
         {% endblock %}
     </div></div>
-    <div class="right-column" id="logo-space">
-      {% block book_list_logos %}
-      <a href="http://www.nck.pl">
-       <img style="float:right; width:200px; margin:1em" src="{% static "img/logo_nck_200horiz_trans.png" %}" alt="Narodowe Centrum Kultury" ></img></a>
-      {% endblock %}
-    </div>
 
     <div class='clearboth'></div>
 
index 65b689d..a1fb991 100644 (file)
 </a></li>
 
 <li id="sponsors">
-    <a href="http://www.nck.pl"><img src="{% static "img/logo_nck.jpg" %}" alt="Narodowe Centrum Kultury" ></img></a>
+    {% for sponsor in sponsors %}
+        {% thumbnail sponsor.logo "80x200" as logo %}
+            <a href="{{ sponsor.url }}" target="_blank"><img src="{{ logo.url }}" alt="{{ sponsor.name }}" /></a>
+        {% endthumbnail %}
+    {% endfor %}
 </li>
 
 {% endblock %}
          <div class="sponsors">
            <a href="/"><img src="{% static "img/logo-220.png" %}" alt="Wolne Lektury" ></img>
            </a>
-           <a href="http://www.nck.pl"><img src="{% static "img/logo_nck_200horiz_trans.png" %}" alt="Narodowe Centrum Kultury" ></img></a>
+        {% for sponsor in sponsors %}
+            {% thumbnail sponsor.logo "220x220" as logo %}
+                <a href="{{ sponsor.url }}" target="_blank"><img src="{{ logo.url }}" alt="{{ sponsor.name }}" /></a>
+            {% endthumbnail %}
+        {% endfor %}
          </div>
 
     {% book_info picture %}
index 78700d1..1f87386 100644 (file)
@@ -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))
 
index 45f8e5d..a5f4c06 100644 (file)
@@ -48,6 +48,11 @@ a {
     margin: 1em 0 0;
 }
 
+#info .sponsors img {
+    margin-bottom: 1em;
+}
+
+
 /* =================================================== */
 /* = Common elements: headings, paragraphs and lines = */
 /* =================================================== */