series_index filter to show x.0 as x

pull/1443/head
Michael Knepher 4 years ago
parent 67dd4a72b0
commit 7e0d9fbace

@ -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

@ -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">

@ -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 %}

@ -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 %}

@ -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 %}

@ -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 %}

@ -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 %}

Loading…
Cancel
Save