diff --git a/cps/db.py b/cps/db.py
index b2ab257a..c4f95b3c 100644
--- a/cps/db.py
+++ b/cps/db.py
@@ -687,9 +687,7 @@ class CalibreDB():
limit_all = result_count
ub.store_ids(result)
-
-
- return result[offset:limit_all], result_count, pagination,
+ return result[offset:limit_all], result_count, pagination
# Creates for all stored languages a translated speaking name in the array for the UI
def speaking_language(self, languages=None):
diff --git a/cps/jinjia.py b/cps/jinjia.py
index 87ba4159..abe1ba15 100644
--- a/cps/jinjia.py
+++ b/cps/jinjia.py
@@ -110,9 +110,21 @@ def timestamptodate(date, fmt=None):
def yesno(value, yes, no):
return yes if value else no
+
@jinjia.app_template_filter('formatfloat')
def formatfloat(value, decimals=1):
formatedstring = '%d' % value
if (value % 1) != 0:
formatedstring = ('%s.%d' % (formatedstring, (value % 1) * 10**decimals)).rstrip('0')
return formatedstring
+
+
+@jinjia.app_template_filter('formatseriesindex')
+def formatseriesindex_filter(series_index):
+ if series_index:
+ if int(series_index) - series_index == 0:
+ return int(series_index)
+ else:
+ return series_index
+ return 0
+
diff --git a/cps/opds.py b/cps/opds.py
index ac0e103b..1eb3c49f 100644
--- a/cps/opds.py
+++ b/cps/opds.py
@@ -408,7 +408,7 @@ def get_metadata_calibre_companion(uuid, library):
def feed_search(term):
if term:
- entries, __ = calibre_db.get_search_results(term)
+ entries, __, ___ = calibre_db.get_search_results(term)
entriescount = len(entries) if len(entries) > 0 else 1
pagination = Pagination(1, entriescount, entriescount)
return render_xml_template('feed.xml', searchterm=term, entries=entries, pagination=pagination)
diff --git a/cps/static/css/style.css b/cps/static/css/style.css
index e2cd4ec7..2294d326 100644
--- a/cps/static/css/style.css
+++ b/cps/static/css/style.css
@@ -143,6 +143,12 @@ a, .danger,.book-remove, .editable-empty, .editable-empty:hover { color: #45b29d
color: #444;
}
+.container-fluid .book .meta .series {
+ font-weight: 400;
+ font-size: 12px;
+ color: #444;
+}
+
.container-fluid .book .meta .author {
font-size: 12px;
color: #999;
diff --git a/cps/templates/author.html b/cps/templates/author.html
index 41a9aebb..0015d6e2 100644
--- a/cps/templates/author.html
+++ b/cps/templates/author.html
@@ -70,6 +70,14 @@
{% endif %}
{% endfor %}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
{% if entry.ratings.__len__() > 0 %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
@@ -114,6 +122,14 @@
{% endif %}
{% endfor %}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
{% for number in range((entry.average_rating)|float|round|int(2)) %}
diff --git a/cps/templates/discover.html b/cps/templates/discover.html
index 7e343d79..9abe3666 100644
--- a/cps/templates/discover.html
+++ b/cps/templates/discover.html
@@ -34,6 +34,14 @@
{% endif %}
{% endfor %}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
{% if entry.ratings.__len__() > 0 %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
diff --git a/cps/templates/index.html b/cps/templates/index.html
index 13105008..e60f92fe 100644
--- a/cps/templates/index.html
+++ b/cps/templates/index.html
@@ -33,6 +33,14 @@
{% endif %}
{% endfor %}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
{% if entry.ratings.__len__() > 0 %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
@@ -101,6 +109,14 @@
{% endif %}
{%endfor%}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
{% if entry.ratings.__len__() > 0 %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
diff --git a/cps/templates/search.html b/cps/templates/search.html
index 868a240e..cba430a4 100644
--- a/cps/templates/search.html
+++ b/cps/templates/search.html
@@ -72,6 +72,15 @@
{% endif %}
{% endfor %}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
+
{% if entry.ratings.__len__() > 0 %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
diff --git a/cps/templates/shelf.html b/cps/templates/shelf.html
index 02f536fa..a2655f96 100644
--- a/cps/templates/shelf.html
+++ b/cps/templates/shelf.html
@@ -43,6 +43,14 @@
{% endif %}
{% endfor %}
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index|formatseriesindex}})
+
+ {% endif %}
{% if entry.ratings.__len__() > 0 %}
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
diff --git a/cps/templates/shelfdown.html b/cps/templates/shelfdown.html
index a1047026..77a37211 100644
--- a/cps/templates/shelfdown.html
+++ b/cps/templates/shelfdown.html
@@ -43,7 +43,14 @@
{% endif %}
{% endfor %}
-
+ {% if entry.series.__len__() > 0 %}
+
+
+ {{entry.series[0].name}}
+
+ ({{entry.series_index}})
+
+ {% endif %}
diff --git a/cps/web.py b/cps/web.py
index 22d6637a..8abae0a9 100644
--- a/cps/web.py
+++ b/cps/web.py
@@ -624,6 +624,10 @@ def render_books_list(data, sort, book_id, page):
order = [db.Books.timestamp.desc()]
if sort == 'old':
order = [db.Books.timestamp]
+ if sort == 'authaz':
+ order = [db.Books.author_sort.asc()]
+ if sort == 'authza':
+ order = [db.Books.author_sort.desc()]
if data == "rated":
if current_user.check_visibility(constants.SIDEBAR_BEST_RATED):