mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
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 %}
|
{% spaceless %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load humanize %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
@todo The author property needs to be an Organization or a Person. We’ll be using Thing which is the more generic ancestor.
|
@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
|
@see https://schema.org/Author
|
||||||
{% endcomment %}
|
{% 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
|
<a
|
||||||
href="{{ author.local_path }}"
|
href="{{ author.local_path }}"
|
||||||
class="author"
|
class="author"
|
||||||
|
@ -12,6 +19,14 @@
|
||||||
itemtype="https://schema.org/Thing"
|
itemtype="https://schema.org/Thing"
|
||||||
><span
|
><span
|
||||||
itemprop="name"
|
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 %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load utilities %}
|
{% load utilities %}
|
||||||
|
{% spaceless %}
|
||||||
|
|
||||||
{% if book.authors %}
|
{% 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 %}
|
{% else %}
|
||||||
<a href="{{ book.local_path }}">{{ book|book_title }}</a>
|
<a href="{{ book.local_path }}">{{ book|book_title }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% endspaceless %}
|
||||||
|
|
Loading…
Reference in a new issue