From a0a15b4598d372b05cb30c06ac5787dc229b7e9d Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 10 Mar 2019 19:26:39 +0100 Subject: [PATCH] Fix max authors shown --- cps/templates/author.html | 8 ++++---- cps/templates/discover.html | 4 ++-- cps/templates/index.html | 8 ++++---- cps/templates/search.html | 4 ++-- cps/templates/shelf.html | 4 ++-- cps/web.py | 1 + 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cps/templates/author.html b/cps/templates/author.html index 4fe231bb..672ea5ce 100644 --- a/cps/templates/author.html +++ b/cps/templates/author.html @@ -41,13 +41,13 @@

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {% if not loop.first %} & {% endif %} {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {% if not loop.first %} @@ -91,10 +91,10 @@

{{entry.title|shortentitle}}

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {{author.name.replace('|',',')}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {{author.name.replace('|',',')}} diff --git a/cps/templates/discover.html b/cps/templates/discover.html index 624b2d07..b7d91c35 100644 --- a/cps/templates/discover.html +++ b/cps/templates/discover.html @@ -19,13 +19,13 @@

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {% if not loop.first %} & {% endif %} {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {% if not loop.first %} diff --git a/cps/templates/index.html b/cps/templates/index.html index 5674aeed..aaab0b5a 100755 --- a/cps/templates/index.html +++ b/cps/templates/index.html @@ -22,13 +22,13 @@

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {% if not loop.first %} & {% endif %} {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {% if not loop.first %} @@ -77,13 +77,13 @@

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {% if not loop.first %} & {% endif %} {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {% if not loop.first %} diff --git a/cps/templates/search.html b/cps/templates/search.html index 41f643c7..c98afd69 100644 --- a/cps/templates/search.html +++ b/cps/templates/search.html @@ -46,13 +46,13 @@

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {% if not loop.first %} & {% endif %} {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {% if not loop.first %} diff --git a/cps/templates/shelf.html b/cps/templates/shelf.html index fa89a61a..21ebfa0b 100644 --- a/cps/templates/shelf.html +++ b/cps/templates/shelf.html @@ -28,13 +28,13 @@

{% for author in entry.authors %} - {% if loop.index > config_authors_max and config_authors_max != 0 %} + {% if loop.index > g.config_authors_max and g.config_authors_max != 0 %} {% if not loop.first %} & {% endif %} {{author.name.replace('|',',')|shortentitle(30)}} {% if loop.last %} - (...) + (...) {% endif %} {% else %} {% if not loop.first %} diff --git a/cps/web.py b/cps/web.py index 730df0ce..d59b6ba8 100644 --- a/cps/web.py +++ b/cps/web.py @@ -709,6 +709,7 @@ def before_request(): g.allow_registration = config.config_public_reg g.allow_upload = config.config_uploading g.current_theme = config.config_theme + g.config_authors_max = config.config_authors_max g.public_shelfes = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1).order_by(ub.Shelf.name).all() if not config.db_configured and request.endpoint not in ('basic_configuration', 'login') and '/static/' not in request.path: return redirect(url_for('basic_configuration'))