From a7c555c8537decdcba5ae9cd72cf6c2620729ee3 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 26 Apr 2023 03:38:34 -0500 Subject: [PATCH] Fix feed scroll on mobile --- judge/views/feed.py | 1 + resources/base.scss | 10 +++++++ templates/feed/feed_js.html | 54 +++++++++++++++++++++++------------- templates/feed/has_next.html | 5 +++- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/judge/views/feed.py b/judge/views/feed.py index 89bb882..cd809d5 100644 --- a/judge/views/feed.py +++ b/judge/views/feed.py @@ -27,6 +27,7 @@ class FeedView(InfinitePaginationMixin, ListView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) + context["has_next_page"] = context["page_obj"].has_next() try: context["feed_content_url"] = reverse(self.url_name) except Exception as e: diff --git a/resources/base.scss b/resources/base.scss index 62e204a..48ac6af 100644 --- a/resources/base.scss +++ b/resources/base.scss @@ -853,6 +853,13 @@ select { color: #808080; } +.view-next-page { + margin-left: auto; + margin-right: auto; + margin-top: 1em; + margin-bottom: 1em; +} + @media (max-width: 799px) { #user-links, .anon { padding-right: 0.5em; @@ -877,4 +884,7 @@ select { padding: 2em; border-radius: 1em; } + .view-next-page { + display: none; + } } \ No newline at end of file diff --git a/templates/feed/feed_js.html b/templates/feed/feed_js.html index 80d878d..d5ca182 100644 --- a/templates/feed/feed_js.html +++ b/templates/feed/feed_js.html @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/templates/feed/has_next.html b/templates/feed/has_next.html index 18415b5..9cc45c9 100644 --- a/templates/feed/has_next.html +++ b/templates/feed/has_next.html @@ -1 +1,4 @@ - \ No newline at end of file + +{% if has_next_page %} + +{% endif %} \ No newline at end of file