1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-10-31 15:16:20 +00:00

series_index filter to show x.0 as x

This commit is contained in:
Michael Knepher 2020-06-29 23:34:26 -07:00
parent 67dd4a72b0
commit 7e0d9fbace
7 changed files with 15 additions and 8 deletions

View File

@ -111,3 +111,10 @@ def timestamptodate(date, fmt=None):
@jinjia.app_template_filter('yesno')
def yesno(value, yes, no):
return yes if value else no
@jinjia.app_template_filter('formatseriesindex')
def formatseriesindex_filter(series_index):
if int(series_index) - series_index == 0:
return int(series_index)
else:
return series_index

View File

@ -75,7 +75,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
@ -127,7 +127,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
<div class="rating">

View File

@ -114,7 +114,7 @@
{% endif %}
{% if entry.series|length > 0 %}
<p>{{_('Book')}} {{entry.series_index}} {{_('of')}} <a href="{{url_for('web.books_list', data='series',sort='abc', book_id=entry.series[0].id)}}">{{entry.series[0].name}}</a></p>
<p>{{_('Book')}} {{entry.series_index|formatseriesindex}} {{_('of')}} <a href="{{url_for('web.books_list', data='series',sort='abc', book_id=entry.series[0].id)}}">{{entry.series[0].name}}</a></p>
{% endif %}
{% if entry.languages.__len__() > 0 %}

View File

@ -39,7 +39,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}

View File

@ -38,7 +38,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}
@ -114,7 +114,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}

View File

@ -81,7 +81,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}

View File

@ -48,7 +48,7 @@
<a href="{{url_for('web.books_list', data='series', sort='new', book_id=entry.series[0].id )}}">
{{entry.series[0].name}}
</a>
({{entry.series_index|int}})
({{entry.series_index|formatseriesindex}})
</p>
{% endif %}
{% if entry.ratings.__len__() > 0 %}