mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Merge pull request #995 from bookwyrm-social/show-subtitles
Show subtitles when titles are very short
This commit is contained in:
commit
deb1257114
3 changed files with 16 additions and 4 deletions
|
@ -1,7 +1,8 @@
|
|||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% if book.authors %}
|
||||
{% blocktrans with path=book.local_path title=book.title %}<a href="{{ path }}">{{ title }}</a> by {% endblocktrans %}{% include 'snippets/authors.html' with book=book %}
|
||||
{% blocktrans with path=book.local_path title=book|title %}<a href="{{ path }}">{{ title }}</a> by {% endblocktrans %}{% include 'snippets/authors.html' with book=book %}
|
||||
{% else %}
|
||||
<a href="{{ book.local_path }}">{{ book.title }}</a>
|
||||
<a href="{{ book.local_path }}">{{ book|title }}</a>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
{% if status.book %}
|
||||
{% if status.status_type == 'GeneratedNote' or status.status_type == 'Rating' %}
|
||||
<a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>{% if status.status_type == 'Rating' %}:
|
||||
<a href="/book/{{ status.book.id }}">{{ status.book|title }}</a>{% if status.status_type == 'Rating' %}:
|
||||
<span
|
||||
itemprop="reviewRating"
|
||||
itemscope
|
||||
|
@ -62,7 +62,7 @@
|
|||
{% include 'snippets/book_titleby.html' with book=status.book %}
|
||||
{% endif %}
|
||||
{% elif status.mention_books %}
|
||||
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first.title }}</a>
|
||||
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first|title }}</a>
|
||||
{% endif %}
|
||||
|
||||
{% if status.progress %}
|
||||
|
|
|
@ -168,6 +168,17 @@ def get_next_shelf(current_shelf):
|
|||
return "to-read"
|
||||
|
||||
|
||||
@register.filter(name="title")
|
||||
def get_title(book):
|
||||
""" display the subtitle if the title is short """
|
||||
if not book:
|
||||
return ""
|
||||
title = book.title
|
||||
if len(title) < 6 and book.subtitle:
|
||||
title = "{:s}: {:s}".format(title, book.subtitle)
|
||||
return title
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
def related_status(notification):
|
||||
""" for notifications """
|
||||
|
|
Loading…
Reference in a new issue