From: Radek Czajka <rczajka@rczajka.pl>
Date: Thu, 3 Nov 2022 13:30:10 +0000 (+0100)
Subject: fixes
X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/f3872a90b13a88be0473e3ce3126240d0d5cbb74

fixes
---

diff --git a/src/catalogue/models/collection.py b/src/catalogue/models/collection.py
index 412a976d4..f1a582cbe 100644
--- a/src/catalogue/models/collection.py
+++ b/src/catalogue/models/collection.py
@@ -56,6 +56,9 @@ class Collection(models.Model):
         from catalogue.models import Book
         return Book.objects.filter(self.get_query())
 
+    def get_5_books(self):
+        return self.get_books()[:5]
+
     @cached_render('catalogue/collection_box.html')
     def box(self):
         return {
diff --git a/src/catalogue/templates/catalogue/2022/collections.html b/src/catalogue/templates/catalogue/2022/collections.html
index ba25bcb64..5fb4078ea 100644
--- a/src/catalogue/templates/catalogue/2022/collections.html
+++ b/src/catalogue/templates/catalogue/2022/collections.html
@@ -26,7 +26,7 @@
             </p>
           </div>
         <div class="l-books">
-          {% for book in collection.get_books %}
+          {% for book in collection.get_5_books %}
             {% include 'catalogue/2022/book_box.html' %}
           {% endfor %}
         </div>
diff --git a/src/social/templates/social/carousel_2022.html b/src/social/templates/social/carousel_2022.html
index acdf5fe61..edaa3bb5b 100644
--- a/src/social/templates/social/carousel_2022.html
+++ b/src/social/templates/social/carousel_2022.html
@@ -1,3 +1,7 @@
+{% if banner %}
 <a href="{{ banner.link }}">
+  {% if banner.picture %}
   <img src="{{ banner.image.url }}">
+  {% endif %}
 </a>
+{% endif %}
diff --git a/src/wolnelektury/templates/2022/main_page.html b/src/wolnelektury/templates/2022/main_page.html
index b541467ad..8112c09e0 100644
--- a/src/wolnelektury/templates/2022/main_page.html
+++ b/src/wolnelektury/templates/2022/main_page.html
@@ -143,7 +143,7 @@
       <section class="l-section">
         <div class="l-collections js-collections">
           <div class="l-collections__header">
-            <h3>{{ recommended_collection.title }}</h3>
+            <h3><a href="{{ recommended_collection.get_absolute_url }}">{{ recommended_collection.title }}</a></h3>
             {% comment %}
             <div class="l-your-books__header__actions">
               <button class="js-prev-slide"><i class="icon icon-arrow-left"></i></button>
@@ -152,7 +152,7 @@
             {% endcomment %}
           </div>
           <div class="l-books">
-            {% for book in recommended_collection.get_books %}
+            {% for book in recommended_collection.get_5_books %}
               {% include 'catalogue/2022/book_box.html' %}
             {% endfor %}
           </div>
@@ -186,7 +186,7 @@
               <h3>
                 Zapisz się na nasz <strong>Newsletter!</strong>
               </h3>
-              <a href="{% url 'subscribe' %}/?pk_campaign=home" class="l-button l-button--default">Weź udział</a>
+              <a href="{% url 'subscribe' %}?pk_campaign=home" class="l-button l-button--default">Weź udział</a>
             </div>
           </div>
         </div>
@@ -305,7 +305,7 @@
           </ul>
         </div>
 
-        {% sponsor_page 'footer' %}
+        {#% sponsor_page 'footer' %#}
 
       </div>
     </section>