forked from mirrors/bookwyrm
Limit authors displayed in status
This commit is contained in:
parent
a13db6adc3
commit
a679a46bca
2 changed files with 25 additions and 3 deletions
|
@ -1,9 +1,16 @@
|
|||
{% spaceless %}
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
{% comment %}
|
||||
@todo The author property needs to be an Organization or a Person. We’ll be using Thing which is the more generic ancestor.
|
||||
@see https://schema.org/Author
|
||||
{% endcomment %}
|
||||
{% for author in book.authors.all %}
|
||||
{% firstof limit None as limit %}
|
||||
{% with subtraction_value='-'|add:limit %}
|
||||
{% with remainder_count=book.authors.count|add:subtraction_value %}
|
||||
{% with remainder_count_display=remainder_count|intcomma %}
|
||||
|
||||
{% for author in book.authors.all|slice:limit %}
|
||||
<a
|
||||
href="{{ author.local_path }}"
|
||||
class="author"
|
||||
|
@ -12,6 +19,14 @@
|
|||
itemtype="https://schema.org/Thing"
|
||||
><span
|
||||
itemprop="name"
|
||||
>{{ author.name }}<span></a>{% if not forloop.last %}, {% endif %}
|
||||
>{{ author.name }}<span></a>{% if not forloop.last %}, {% elif remainder_count > 0 %}, {% blocktrans trimmed count counter=remainder_count %}
|
||||
and {{ remainder_count_display }} other
|
||||
{% plural %}
|
||||
and {{ remainder_count_display }} others
|
||||
{% endblocktrans %}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endspaceless %}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
{% spaceless %}
|
||||
|
||||
{% if book.authors %}
|
||||
{% blocktrans with path=book.local_path title=book|book_title %}<a href="{{ path }}">{{ title }}</a> by {% endblocktrans %}{% include 'snippets/authors.html' with book=book %}
|
||||
{% blocktrans trimmed with path=book.local_path title=book|book_title %}
|
||||
<a href="{{ path }}">{{ title }}</a> by
|
||||
{% endblocktrans %}
|
||||
{% include 'snippets/authors.html' with book=book limit=3 %}
|
||||
|
||||
{% else %}
|
||||
<a href="{{ book.local_path }}">{{ book|book_title }}</a>
|
||||
{% endif %}
|
||||
|
||||
{% endspaceless %}
|
||||
|
|
Loading…
Reference in a new issue