From: Marek Stępniowski <marek@stepniowski.com>
Date: Sat, 13 Sep 2008 21:36:10 +0000 (+0200)
Subject: Added link to download all books from current shelf.
X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/062c5ec3437a944e39b486d36a54a6a11fa332d1

Added link to download all books from current shelf.
---

diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py
index ade37e52a..052537491 100644
--- a/apps/catalogue/views.py
+++ b/apps/catalogue/views.py
@@ -103,7 +103,7 @@ def tagged_object_list(request, tags=''):
         raise Http404
     
     model = models.Book
-    shelf_is_set = any(tag.category == 'set' for tag in tags)
+    shelf_is_set = (len(tags) == 1 and tags[0].category == 'set')
     theme_is_set = any(tag.category == 'theme' for tag in tags)
     if theme_is_set:
         model = models.Fragment
diff --git a/wolnelektury/media/css/master.css b/wolnelektury/media/css/master.css
index cb39604c6..860a2dd50 100644
--- a/wolnelektury/media/css/master.css
+++ b/wolnelektury/media/css/master.css
@@ -321,6 +321,19 @@ div.shown-tags p {
     color: #999;
 }
 
+#download-shelf {
+    display: block;
+    width: 100%;
+    height: 1.5em;
+    background-color: #EEE;
+    margin-top: 0.5em;
+    padding: 0.5em 0;
+    -moz-border-radius: 4px;
+    -webkit-border-radius: 4px;
+    border-radius: 4px;
+    text-align: center;    
+}
+
 /* ============================ */
 /* = Books and fragments list = */
 /* ============================ */
diff --git a/wolnelektury/templates/catalogue/tagged_object_list.html b/wolnelektury/templates/catalogue/tagged_object_list.html
index aef6ad5c3..4567e742a 100644
--- a/wolnelektury/templates/catalogue/tagged_object_list.html
+++ b/wolnelektury/templates/catalogue/tagged_object_list.html
@@ -71,6 +71,11 @@
             <div id="toggle-description"><p>Zwiń opis ▲</p></div>
         {% endif %}
         {% endwith %}
+        {% if shelf_is_set %}
+            <a id="download-shelf">
+                Pobierz wszystkie książki z tej półki
+            </a>
+        {% endif %}
         <ol>
         {% for book in object_list %}
             <li>{{ book.short_html }}</li>