diff --git a/fedireads/templates/book.html b/fedireads/templates/book.html index 1ebf0e48..bb76cc5f 100644 --- a/fedireads/templates/book.html +++ b/fedireads/templates/book.html @@ -8,24 +8,20 @@

{{ book.data.title }}

by {{ book.authors.first.data.name }} {{ rating | stars }} {{ rating }} -
{{ book.data.description }}
+
{{ book.data.description | description }}
- -

Leave a review

- + +
+

Reviews

+ {% if not reviews %} +

No reviews yet!

+ {% endif %}
{% csrf_token %} {{ review_form.as_p }}
-
- -
-

Reviews

- {% if not reviews %} -

No reviews yet!

- {% endif %} {% for review in reviews %}

{{ review.name }} diff --git a/fedireads/templates/feed.html b/fedireads/templates/feed.html index 45b09d28..ffbb2b83 100644 --- a/fedireads/templates/feed.html +++ b/fedireads/templates/feed.html @@ -86,7 +86,7 @@ {{ activity.book.data.title }} by {{ activity.book.authors.first.data.name }} -
{{ activity.book.data.description }}
+
{{ activity.book.data.description | description }}

@@ -100,11 +100,10 @@ {{ activity.book.data.title }} by {{ activity.book.authors.first.data.name }} -
{{ activity.book.data.description }}

{{ activity.name }}

-

{{ activity.rating | stars }} stars

+

{{ activity.rating | stars }}

{{ activity.review_content }}

diff --git a/fedireads/templates/user.html b/fedireads/templates/user.html index 72fa6864..53fb2a94 100644 --- a/fedireads/templates/user.html +++ b/fedireads/templates/user.html @@ -60,7 +60,7 @@
{% for shelf in shelves %}
-

{{ shelf.shelf.name }}

+

{{ shelf.name }}

{% if shelf.books %} diff --git a/fedireads/templatetags/fr_display.py b/fedireads/templatetags/fr_display.py index 952a2b3f..a112b436 100644 --- a/fedireads/templatetags/fr_display.py +++ b/fedireads/templatetags/fr_display.py @@ -11,5 +11,18 @@ def dict_key(d, k): @register.filter(name='stars') def stars(number): ''' turn integers into stars ''' - number = int(number) + try: + number = int(number) + except TypeError: + number = 0 return ('★' * number) + '☆' * (5 - number) + +@register.filter(name='description') +def description_format(description): + ''' handle the various OL description formats ''' + if isinstance(description, dict) and 'value' in description: + description = description['value'] + if '----------' in description: + description = description.split('----------')[0] + + return description.strip()