{% load i18n %}
<div class="collection-box white-box">
<h2><a href="{{ collection.get_absolute_url }}">{% trans "Collection" %}: {{ collection }}</a></h2>
+ <p>
{% if collection.description %}
{{ collection.description|safe|truncatewords_html:40 }}
{% endif %}
- {% for book in collection.get_books|slice:":5" %}
- {{ book.mini_box }}
- {% endfor %}
- {% with collection.get_books.count|add:-5 as more %}
- {% if more > 0 %}
- <a href="{{ collection.get_absolute_url }}">
- {% blocktrans count c=more %}and one more{% plural %}and {{ c }} more{% endblocktrans %}
+ </p>
+ <div class="covers">
+ {% for book in collection.get_books|slice:":5" %}
+ <a href="{{ book.get_absolute_url }}">
+ <img src="{{ book.cover_thumb.url }}" alt="{{ book.pretty_title }}" title="{{ book.pretty_title }}">
</a>
- {% endif %}
- {% endwith %}
+ {% endfor %}
+ </div>
</div>
{% endspaceless %}
def collection(request, slug):
coll = get_object_or_404(Collection, slug=slug)
- return render(request, 'catalogue/collection.html', {'collection': coll})
+ return render(request, 'catalogue/collection.html', {
+ 'collection': coll,
+ 'active_menu_item': 'collections',
+ })
def differentiate_tags(request, tags, ambiguous_slugs):
objects = Collection.objects.filter(listed=True)
if len(objects) > 3:
- best = random.sample(list(objects), 3)
+ best = random.sample(list(objects), 4)
else:
best = objects
return render(request, 'catalogue/collections.html', {
'objects': objects,
'best': best,
+ 'active_menu_item': 'collections'
})
@include size(padding, 26px);
}
}
+
+
+.collection-box {
+ display: inline-block;
+ vertical-align: top;
+
+ @media screen and (min-width:500px) {
+ width: 465px;
+ }
+
+ p {
+ height: 75px;
+ overflow: hidden;
+ }
+ .covers {
+ line-height: 0;
+ }
+}
<li{% if active_menu_item == 'audiobooks' %} class="active"{% endif %}>
<a href="{% url 'audiobook_list' %}">{% trans "Audiobooks" %}</a>
</li>
- <li{% if active_menu_item == 'all_works' %} class="active"{% endif %}>
- <a href="{% url 'catalogue' %}">{% trans "All works" %}</a>
+ <li{% if active_menu_item == 'collections' %} class="active"{% endif %}>
+ <a href="{% url 'catalogue_collections' %}">{% trans "Collections" %}</a>
</li>
<li>
<a href="{% url 'subscribe' %}">{% trans "Newsletter" %}</a>
</div>
</section>
+ <section>
+ <h1>
+ <a href="{% url 'recent_list' %}">
+ {% trans "Recent publications" %}
+ →
+ </a>
+ </h1>
+ {% for book in last_published %}
+ {{ book.mini_box }}
+ {% endfor %}
+ </section>
+
+ {% if collections %}
+ <section>
+ <h1>
+ <a href="{% url 'catalogue_collections' %}">
+ {% trans "Collections" %}
+ →
+ </a>
+ </h1>
+ {% for collection in collections %}
+ {{ collection.box }}
+ {% endfor %}
+ </section>
+ {% endif %}
+
<section id="main-theme">
- <h1>{% trans "Motifs and themes" %}</h1>
+ <h1>
+ <a href="{% url 'theme_catalogue' %}">
+ {% trans "Motifs and themes" %}
+ →
+ </a>
+ </h1>
<div class="white-box normal-text">
<h2>{% trans "Theme" %}: {{ theme }}</h2>
<p>{% trans "Explore works with the same theme" %}</p>
{% endcache %}
{% endif %}
</div>
- <a class="more" href="{% url 'theme_catalogue' %}">{% trans "See motifs catalog" %}</a>
- </section>
-
- {% if collection %}
- <section>
- <h1>{% trans "Collections" %}</h1>
- {{ collection.box }}
- <a class="more" href="{% url 'catalogue_collections' %}">{% trans "See collections catalog" %}</a>
- </section>
- {% endif %}
-
- <section>
- <h1>{% trans "Recent publications" %}</h1>
- {% for book in last_published %}
- {{ book.mini_box }}
- {% endfor %}
- <a class="more" href="{% url 'recent_list' %}">{% trans "More recent publications" %}</a>
</section>
<div class="clearboth"></div>
break
break
- # Choose a collection for main.
- try:
- ctx['collection'] = Collection.objects.filter(listed=True).order_by('?')[:1][0]
- except IndexError:
- pass
+ # Choose collections for main.
+ ctx['collections'] = Collection.objects.filter(listed=True).order_by('?')[:4]
best = []
best_places = 5