Cleanup
[wolnelektury.git] / src / catalogue / templates / catalogue / book_box.html
diff --git a/src/catalogue/templates/catalogue/book_box.html b/src/catalogue/templates/catalogue/book_box.html
new file mode 100644 (file)
index 0000000..97c61d9
--- /dev/null
@@ -0,0 +1,55 @@
+{% load sorl_thumbnail %}
+
+<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 src="{{ im.url }}"
+               srcset="{{ im.url }} 1x, {{ im.url|resolution:"2x" }} 2x"
+               width="{{ im.x }}" height="{{ im.y }}" />
+          {% endthumbnail %}
+        {% endif %}
+      {% else %}
+        {% if book.cover_clean %}
+          <img src="{{ book.cover_clean.url }}" alt="{{ book.title }}">
+        {% 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_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="{{ book.get_absolute_url }}" class="icon icon-like" data-book="{{ book.pk }}" data-book-slug="{{ book.slug }}"></a>
+  </div>
+  <h3 class="s">
+    {% for author in book.authors %}
+      <a href="{{ author.get_absolute_url }}">{{ author }}</a>{% if not forloop.last %}, {% endif %}
+    {% endfor %}
+  </h3>
+  <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>