Added thumbnail urls to book cover srcsets with cache busting ids
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<div id="books" class="col-sm-3 col-lg-2 col-xs-6 book">
|
||||
<div class="cover">
|
||||
<a href="{{ url_for('web.show_book', book_id=entry.id) }}">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="meta">
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
{% macro book_cover_image(book, book_title) -%}
|
||||
<img
|
||||
srcset="{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id(1)) }} 1x,
|
||||
{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id(2)) }} 2x"
|
||||
src="{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id) }}"
|
||||
alt="{{ book_title }}"
|
||||
/>
|
||||
{% macro book_cover_image(book, thumbnails) -%}
|
||||
{%- set book_title = book.title if book.title else book.name -%}
|
||||
{% set srcset = thumbnails|get_book_thumbnail_srcset if thumbnails|length else '' %}
|
||||
{%- if srcset|length -%}
|
||||
<img
|
||||
srcset="{{ srcset }}"
|
||||
src="{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id) }}"
|
||||
alt="{{ book_title }}"
|
||||
/>
|
||||
{%- else -%}
|
||||
<img src="{{ url_for('web.get_cached_cover', cache_id=book|book_cover_cache_id) }}" alt="{{ book_title }}" />
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% if book %}
|
||||
<div class="col-sm-3 col-lg-3 col-xs-12">
|
||||
<div class="cover">
|
||||
{{ book_cover_image(book, book.title) }}
|
||||
{{ book_cover_image(book, book.id|get_book_thumbnails(thumbnails)) }}
|
||||
</div>
|
||||
{% if g.user.role_delete_books() %}
|
||||
<div class="text-center">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3 col-lg-3 col-xs-5">
|
||||
<div class="cover">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9 col-lg-9 book-meta">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="cover">
|
||||
{% if entry.has_cover is defined %}
|
||||
<a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<div class="col-sm-3 col-lg-2 col-xs-6 book sortable" {% if entry[0].sort %}data-name="{{entry[0].series[0].name}}"{% endif %} data-id="{% if entry[0].series[0].name %}{{entry[0].series[0].name}}{% endif %}">
|
||||
<div class="cover">
|
||||
<a href="{{url_for('web.books_list', data=data, sort_param='new', book_id=entry[0].series[0].id )}}">
|
||||
{{ book_cover_image(entry[0], entry[0].name) }}
|
||||
{{ book_cover_image(entry[0], entry[0].id|get_book_thumbnails(thumbnails)) }}
|
||||
<span class="badge">{{entry.count}}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="col-sm-3 col-lg-2 col-xs-6 book" id="books_rand">
|
||||
<div class="cover">
|
||||
<a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="meta">
|
||||
@@ -83,7 +83,7 @@
|
||||
<div class="col-sm-3 col-lg-2 col-xs-6 book" id="books">
|
||||
<div class="cover">
|
||||
<a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="meta">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<div class="cover">
|
||||
{% if entry.has_cover is defined %}
|
||||
<a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="col-sm-3 col-lg-2 col-xs-6 book">
|
||||
<div class="cover">
|
||||
<a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
||||
{{ book_cover_image(entry, entry.title) }}
|
||||
{{ book_cover_image(entry, entry.id|get_book_thumbnails(thumbnails)) }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="meta">
|
||||
|
||||
Reference in New Issue
Block a user