From ce4553b367beb905fcf81d2efab9e7d265c52402 Mon Sep 17 00:00:00 2001 From: Joachim Date: Tue, 3 Aug 2021 17:45:52 +0200 Subject: [PATCH] Add simple tag to provide fallback if original image doesn't exist --- bookwyrm/templates/snippets/book_cover.html | 86 +++++++++++++++------ bookwyrm/templatetags/utilities.py | 11 +++ 2 files changed, 73 insertions(+), 24 deletions(-) diff --git a/bookwyrm/templates/snippets/book_cover.html b/bookwyrm/templates/snippets/book_cover.html index 8068051d..84303015 100644 --- a/bookwyrm/templates/snippets/book_cover.html +++ b/bookwyrm/templates/snippets/book_cover.html @@ -3,6 +3,7 @@ {% load i18n %} {% load static %} {% load imagekit %} +{% load utilities %} {% if book.cover %} @@ -21,93 +22,130 @@ {% elif size_mobile == 'small' %} {% elif size_mobile == 'medium' %} {% elif size_mobile == 'large' %} {% elif size_mobile == 'xlarge' %} {% elif size_mobile == 'xxlarge' %} {% endif %} {% if size == 'xsmall' %} - - + + {% elif size == 'small' %} - - + + {% elif size == 'medium' %} - - + + {% elif size == 'large' %} - - + + {% elif size == 'xlarge' %} - - + + {% elif size == 'xxlarge' %} - - + + {% endif %} {% endif %}