From f8139f3198fe8230e08c8c55911a8dda68be5713 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 11 Jul 2020 12:09:34 +0200 Subject: [PATCH] Store last selected view for sidebar (not for categories, series, publishers, ..) Started making search paged --- cps/static/js/filter_list.js | 12 +- cps/templates/author.html | 18 +- cps/templates/detail.html | 8 +- cps/templates/discover.html | 4 +- cps/templates/grid.html | 4 +- cps/templates/index.html | 22 +-- cps/templates/languages.html | 2 +- cps/templates/layout.html | 2 +- cps/templates/list.html | 2 +- cps/templates/search.html | 22 +-- cps/templates/search_form.html | 2 +- cps/templates/shelf.html | 4 +- cps/templates/shelfdown.html | 2 +- cps/web.py | 348 ++++++++++++++++++--------------- 14 files changed, 245 insertions(+), 207 deletions(-) diff --git a/cps/static/js/filter_list.js b/cps/static/js/filter_list.js index 8291f0ac..611bf3b4 100644 --- a/cps/static/js/filter_list.js +++ b/cps/static/js/filter_list.js @@ -19,6 +19,14 @@ var direction = 0; // Descending order var sort = 0; // Show sorted entries $("#sort_name").click(function() { + /*$.ajax({ + method:"post", + contentType: "application/json; charset=utf-8", + dataType: "json", + url: window.location.pathname + "/../../ajax/view", + data: "{" + st + "}", + });*/ + var count = 0; var index = 0; var store; @@ -40,9 +48,7 @@ $("#sort_name").click(function() { count++; } }); - /*listItems.sort(function(a,b){ - return $(a).children()[1].innerText.localeCompare($(b).children()[1].innerText) - });*/ + // Find count of middle element if (count > 20) { var middle = parseInt(count / 2, 10) + (count % 2); diff --git a/cps/templates/author.html b/cps/templates/author.html index 18742003..41a9aebb 100644 --- a/cps/templates/author.html +++ b/cps/templates/author.html @@ -23,14 +23,14 @@

{{_("In Library")}}

{% endif %} @@ -53,7 +53,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} (...) {% endif %} @@ -61,7 +61,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% endif %} {% endfor %} {% for format in entry.data %} diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 956325a7..1210a6ca 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -92,7 +92,7 @@

{{entry.title|shortentitle(40)}}

{% for author in entry.authors %} - {{author.name.replace('|',',')}} + {{author.name.replace('|',',')}} {% if not loop.last %} & {% endif %} @@ -114,7 +114,7 @@ {% endif %} {% if entry.series|length > 0 %} -

{{_('Book')}} {{entry.series_index}} {{_('of')}} {{entry.series[0].name}}

+

{{_('Book')}} {{entry.series_index}} {{_('of')}} {{entry.series[0].name}}

{% endif %} {% if entry.languages.__len__() > 0 %} @@ -143,7 +143,7 @@ {% for tag in entry.tags %} - {{tag.name}} + {{tag.name}} {%endfor%}

@@ -154,7 +154,7 @@

{{_('Publisher')}}: - {{entry.publishers[0].name}} + {{entry.publishers[0].name}}

diff --git a/cps/templates/discover.html b/cps/templates/discover.html index 1326f9a9..7e343d79 100644 --- a/cps/templates/discover.html +++ b/cps/templates/discover.html @@ -22,7 +22,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} (...) {% endif %} @@ -30,7 +30,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% endif %} {% endfor %}

diff --git a/cps/templates/grid.html b/cps/templates/grid.html index 8fb084fd..16b1608f 100644 --- a/cps/templates/grid.html +++ b/cps/templates/grid.html @@ -27,13 +27,13 @@ {% for entry in entries %}
diff --git a/cps/templates/index.html b/cps/templates/index.html index 3498791c..13105008 100644 --- a/cps/templates/index.html +++ b/cps/templates/index.html @@ -21,7 +21,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} (...) {% endif %} @@ -29,7 +29,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% endif %} {% endfor %}

@@ -54,14 +54,14 @@

{{_(title)}}

@@ -84,7 +84,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} (...) {% endif %} @@ -92,7 +92,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% endif %} {% endfor %} {% for format in entry.data %} diff --git a/cps/templates/languages.html b/cps/templates/languages.html index 3c30e4d0..2b482e19 100644 --- a/cps/templates/languages.html +++ b/cps/templates/languages.html @@ -10,7 +10,7 @@ {% endif %}
{{lang_counter[loop.index0].bookcount}}
- +
{% endfor %}
diff --git a/cps/templates/layout.html b/cps/templates/layout.html index a1dbe976..55d6adbc 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -128,7 +128,7 @@ {% for element in sidebar %} {% if g.user.check_visibility(element['visibility']) and element['public'] %} - + {% endif %} {% endfor %} {% if g.user.is_authenticated or g.allow_anonymous %} diff --git a/cps/templates/list.html b/cps/templates/list.html index a2938be1..13a818d8 100644 --- a/cps/templates/list.html +++ b/cps/templates/list.html @@ -32,7 +32,7 @@ {% endif %}
{{entry.count}}
-
+ -
- ? -
{{_('All')}}
- {% endif %}
@@ -59,7 +55,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} (...) {% endif %} @@ -67,7 +63,7 @@ {% if not loop.first %} & {% endif %} - {{author.name.replace('|',',')|shortentitle(30)}} + {{author.name.replace('|',',')|shortentitle(30)}} {% endif %} {% endfor %} {% for format in entry.data %} diff --git a/cps/templates/search_form.html b/cps/templates/search_form.html index 60cffa1d..25e30d35 100644 --- a/cps/templates/search_form.html +++ b/cps/templates/search_form.html @@ -1,7 +1,7 @@ {% extends "layout.html" %} {% block body %}
-