Generally working version.
[wolnelektury.git] / src / catalogue / templates / catalogue / collection_box.html
diff --git a/src/catalogue/templates/catalogue/collection_box.html b/src/catalogue/templates/catalogue/collection_box.html
new file mode 100644 (file)
index 0000000..7c09294
--- /dev/null
@@ -0,0 +1,21 @@
+{% spaceless %}
+{% load i18n %}
+{% load ssi_include from ssify %}
+<div class="collection-box white-box">
+    <h2><a href="{{ obj.get_absolute_url }}">{% trans "Collection" %}: {{ obj }}</a></h2>
+    {% if obj.description %}
+    {{ obj.description|safe|truncatewords_html:40 }}
+    {% endif %}
+    {% for b in obj.get_books|slice:":5" %}
+        {% ssi_include 'catalogue_book_mini' pk=b.pk %}
+    {% endfor %}
+    {% with obj.get_books.count|add:-5 as more %}
+        {% if more > 0 %}
+            <a href="{{ obj.get_absolute_url }}">
+                {% blocktrans with c=more %}and {{ c }} more{% endblocktrans %}
+            </a>
+        {% endif %}
+    {% endwith %}
+
+</div>
+{% endspaceless %}