diff --git a/bookwyrm/templates/author/author.html b/bookwyrm/templates/author/author.html index bf2c8f3fd..0d7d102d0 100644 --- a/bookwyrm/templates/author/author.html +++ b/bookwyrm/templates/author/author.html @@ -23,114 +23,128 @@ -
+
+ {% if author.bio %} +
+ {% include "snippets/trimmed_text.html" with full=author.bio trim_length=200 %} +
+ {% endif %} - {% if author.aliases or author.born or author.died or author.wikipedia_link or author.openlibrary_key or author.inventaire_id or author.isni %} + {% firstof author.aliases author.born author.died as details %} + {% firstof author.wikipedia_link author.openlibrary_key author.inventaire_id author.isni as links %} + {% if details or links %}
-
-
+ {% if details %} +
+

{% trans "Author details" %}

+
{% if author.aliases %} -
+
{% trans "Aliases:" %}
- {% for alias in author.aliases %} -
- {{alias}}{% if not forloop.last %}, {% endif %} -
- {% endfor %} +
+ {% include "snippets/trimmed_list.html" with items=author.aliases itemprop="alternateName" %} +
{% endif %} {% if author.born %} -
+
{% trans "Born:" %}
{{ author.born|naturalday }}
{% endif %} {% if author.died %} -
+
{% trans "Died:" %}
{{ author.died|naturalday }}
{% endif %}
+
+ {% endif %} - {% if author.wikipedia_link %} -

- - {% trans "Wikipedia" %} - -

- {% endif %} - - {% if author.isni %} -

- - {% trans "View ISNI record" %} - -

- {% endif %} - - {% if author.openlibrary_key %} -

- - {% trans "View on OpenLibrary" %} - - {% if request.user.is_authenticated and perms.bookwyrm.edit_book %} -

- {% csrf_token %} - -
+ {% if links %} +
+

{% trans "External links" %}

+
+ {% if author.wikipedia_link %} +

+ + {% trans "Wikipedia" %} + +

{% endif %} -

- {% endif %} - {% if author.inventaire_id %} -

- - {% trans "View on Inventaire" %} - - {% if request.user.is_authenticated and perms.bookwyrm.edit_book %} -

- {% csrf_token %} - -
+ {% if author.isni %} +

+ + {% trans "View ISNI record" %} + +

{% endif %} -

- {% endif %} - {% if author.librarything_key %} -

- - {% trans "View on LibraryThing" %} - -

- {% endif %} + {% if author.openlibrary_key %} +

+ + {% trans "View on OpenLibrary" %} + + {% if request.user.is_authenticated and perms.bookwyrm.edit_book %} +

+ {% csrf_token %} + +
+ {% endif %} +

+ {% endif %} - {% if author.goodreads_key %} -

- - {% trans "View on Goodreads" %} - -

- {% endif %} -
-
- {% endif %} -
- {% if author.bio %} - {{ author.bio|to_markdown|safe }} + {% if author.inventaire_id %} +

+ + {% trans "View on Inventaire" %} + + {% if request.user.is_authenticated and perms.bookwyrm.edit_book %} +

+ {% csrf_token %} + +
+ {% endif %} +

+ {% endif %} + + {% if author.librarything_key %} +

+ + {% trans "View on LibraryThing" %} + +

+ {% endif %} + + {% if author.goodreads_key %} +

+ + {% trans "View on Goodreads" %} + +

+ {% endif %} +
+ {% endif %}
+ {% endif %}
+ +
-

{% blocktrans with name=author.name %}Books by {{ name }}{% endblocktrans %}

+

{% blocktrans with name=author.name %}Books by {{ name }}{% endblocktrans %}

{% for book in books %} -
- {% include 'landing/small-book.html' with book=book %} +
+
+ {% include 'landing/small-book.html' with book=book %} +
{% include 'snippets/shelve_button/shelve_button.html' with book=book %}
{% endfor %} diff --git a/bookwyrm/templates/snippets/trimmed_list.html b/bookwyrm/templates/snippets/trimmed_list.html new file mode 100644 index 000000000..2e5f4595b --- /dev/null +++ b/bookwyrm/templates/snippets/trimmed_list.html @@ -0,0 +1,34 @@ +{% spaceless %} +{% load i18n %} +{% load humanize %} +{% firstof limit 3 as limit %} +{% with subtraction_value='-'|add:limit %} +{% with remainder_count=items|length|add:subtraction_value %} +{% with remainder_count_display=remainder_count|intcomma %} + +
+ + {% for item in items|slice:limit %} + {{ item }}{% 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 %} + + + {% for item in items|slice:"3:" %} + {{ item }}{% if not forloop.last %}, {% endif %} + {% endfor %} +
+ + +{% endwith %} +{% endwith %} +{% endwith %} +{% endspaceless %}