Nicer search, minor fixes.
[wolnelektury.git] / src / catalogue / templates / catalogue / 2022 / book_box.html
index 2d2ac05..97c61d9 100644 (file)
@@ -1,12 +1,14 @@
 {% load sorl_thumbnail %}
 
-<article class="l-books__item" data-pop="-{{ book.popularity.count }}">
-  <figure class="l-books__item__img" style="height:240px">
+<article class="l-books__item book-container-activator" data-pop="-{{ book.popularity.count }}" data-longpress="hover">
+  <figure class="l-books__item__img book-container book-container-{{ book.pk }}" data-book="{{ book.pk }}">
     <a href="{{ book.get_absolute_url }}">
       {% if book.is_picture %}
         {% if book.image_file %}
           {% thumbnail book.image_file "170x240" crop="center" as im %}
-          <img style="float: left; margin:{{ im|margin:"170x240" }}" src="{{ im.url }}" width="{{ im.x }}" height="{{ im.y }}" />
+          <img src="{{ im.url }}"
+               srcset="{{ im.url }} 1x, {{ im.url|resolution:"2x" }} 2x"
+               width="{{ im.x }}" height="{{ im.y }}" />
           {% endthumbnail %}
         {% endif %}
       {% else %}
         {% endif %}
       {% endif %}
     </a>
+
+    <div class="set-tools">
+      <div class="sets"></div>
+      <form method="post" action="{% url 'social_add_set_tag' %}" class="add-set-tag">
+        {% csrf_token %} {# this needs to be copied in with JS #}
+        <input type="hidden" name="book" value="{{ book.id }}">
+        <input name="name" placeholder="nazwa półki" />
+        <button type="submit"></button>
+      </form>
+    </div>
+
   </figure>
   <div class="l-books__item__actions">
     {% if book.is_book %}
       <span class="icon icon-book-alt" title="książka"></span>
     {% endif %}
-    {% if book.has_mp3 %}
+    {% if book.has_mp3_file %}
       <span class="icon icon-audio" title="audiobook"></span>
     {% endif %}
     {% if book.is_picture %}
       <span class="icon icon-picture" title="obraz"></span>
     {% endif %}
-    <!-- a href="#" class="icon icon-like"></a -->
+    <a href="{{ book.get_absolute_url }}" class="icon icon-like" data-book="{{ book.pk }}" data-book-slug="{{ book.slug }}"></a>
   </div>
-  <h3>
+  <h3 class="s">
     {% for author in book.authors %}
       <a href="{{ author.get_absolute_url }}">{{ author }}</a>{% if not forloop.last %}, {% endif %}
     {% endfor %}
   </h3>
-  <h2><a href="{{ book.get_absolute_url }}">{{ book.title }}</a></h2>
+  <h2 class="s"><a href="{{ book.get_absolute_url }}">{{ book.title }}</a></h2>
+  <span class="other-info s">
+    {% for kind in book.kinds %}{{ kind }} {% endfor %}
+    {% for genre in book.genres %}{{ genre }} {% endfor %}
+    {% for epoch in book.epochs %}{{ epoch }} {% endfor %}
+  </span>
 </article>