From d6b55e5e50e35a7191129754295f647eea969656 Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 13 Nov 2021 22:29:22 +0100 Subject: [PATCH] harmonize 'more' button between browse/* and reddit/ now only the subscription feed uses the special features of the pagination macro. preparation for getting rid of this. --- app/browse/__init__.py | 8 ++++---- app/browse/templates/channel.html.j2 | 2 +- app/browse/templates/playlist.html.j2 | 2 +- app/reddit/__init__.py | 4 ++-- app/reddit/templates/reddit.html.j2 | 4 +--- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/browse/__init__.py b/app/browse/__init__.py index f03a8bf..d2c2da7 100644 --- a/app/browse/__init__.py +++ b/app/browse/__init__.py @@ -78,7 +78,7 @@ def channel(channel_id, subpage="videos"): if error: return error, 400 # todo: ugly - title, descr, thumb, rows, more = prepare_channel(result, channel_id) + title, descr, thumb, rows, continuation = prepare_channel(result, channel_id) if not rows: # overran end of list, or is special channel (e.g. music topic) flash("ajax returned nothing; displaying fallback results (15 newest)", "error") return fallback_route(channel_id, subpage) @@ -109,7 +109,7 @@ def channel(channel_id, subpage="videos"): channel_img=thumb, channel_desc=descr, is_subscribed=is_subscribed, - has_more=more) + continuation=continuation) @frontend.route('/user//') @frontend.route('/user//') @@ -156,14 +156,14 @@ def playlist(): flash(f"2 {error}. Loading fallback.", 'error') return fallback_route() - rows, more = prepare_playlist(result) + rows, continuation = prepare_playlist(result) return render_template('playlist.html.j2', title=title, author=author, channel_id=channel_id, rows=rows, - has_more=more) + continuation=continuation) @frontend.route('/', strict_slashes=False) def plain_user_or_video(something): diff --git a/app/browse/templates/channel.html.j2 b/app/browse/templates/channel.html.j2 index 7d0c9c7..27d1299 100644 --- a/app/browse/templates/channel.html.j2 +++ b/app/browse/templates/channel.html.j2 @@ -41,6 +41,6 @@ {% if not rows|length %}no more results{% endif %}
- {{ macros.pagination("more", {'continuation': has_more}, +1) if has_more}} + {{ macros.pagination("more", {'continuation': continuation}, +1) if continuation }}
{% endblock %} diff --git a/app/browse/templates/playlist.html.j2 b/app/browse/templates/playlist.html.j2 index 656d513..facacd1 100644 --- a/app/browse/templates/playlist.html.j2 +++ b/app/browse/templates/playlist.html.j2 @@ -16,6 +16,6 @@ {% if not rows|length %}no more results{% endif %}
- {{ macros.pagination("more", {'continuation': has_more}, +1) if has_more}} + {{ macros.pagination("more", {'continuation': continuation}, +1) if continuation }}
{% endblock %} diff --git a/app/reddit/__init__.py b/app/reddit/__init__.py index a430a96..2e72a7b 100644 --- a/app/reddit/__init__.py +++ b/app/reddit/__init__.py @@ -15,7 +15,7 @@ frontend = Blueprint('reddit', __name__, @frontend.route('/r//') def reddit(subreddit=None): token = getattr(current_user, 'token', 'guest') - after = request.args.get('after') + after = request.args.get('continuation') sortorder = request.args.get('s', "hot") # TODO: verify! timerange = request.args.get('t', None) # TODO: verify! @@ -45,7 +45,7 @@ def reddit(subreddit=None): title = f"/r/{subreddit}" if subreddit else "my subreddits" return render_template('reddit.html.j2', title=title, rows=videos, - subreddits=all_subreddits, after=after) + subreddits=all_subreddits, continuation=after) @frontend.route('/manage/subreddits') # disabled for guest user: @login_required diff --git a/app/reddit/templates/reddit.html.j2 b/app/reddit/templates/reddit.html.j2 index 14d40ce..2349c91 100644 --- a/app/reddit/templates/reddit.html.j2 +++ b/app/reddit/templates/reddit.html.j2 @@ -27,9 +27,7 @@
-{% if after %} -{{ macros.pagination("more", {'after':after}, +1) }} -{% endif %} +{{ macros.pagination("more", {'continuation':continuation}, +1) if continuation }}
{% endblock %} -- 2.39.3