Skip to content
Snippets Groups Projects
Commit 90601de8 authored by Štěpán Farka's avatar Štěpán Farka
Browse files

[FIX] button if no next

parent 856d9761
Branches
No related tags found
2 merge requests!609Release,!608Small tuning and fixes of pirati.cz (main) module
Pipeline #9645 passed
...@@ -218,7 +218,7 @@ class MainHomePage( ...@@ -218,7 +218,7 @@ class MainHomePage(
).content ).content
data = { data = {
"html": html_content.decode("utf-8"), "html": html_content.decode("utf-8"),
"last_page": tweet_page.paginator.num_pages, "has_next": tweet_page.has_next(),
} }
return JsonResponse(data=data, safe=False) return JsonResponse(data=data, safe=False)
...@@ -388,7 +388,7 @@ class MainArticlesPage( ...@@ -388,7 +388,7 @@ class MainArticlesPage(
).content ).content
data = { data = {
"html": html_content.decode("utf-8"), "html": html_content.decode("utf-8"),
"last_page": article_page.paginator.num_pages, "has_next": article_page.has_next(),
} }
return JsonResponse(data=data, safe=False) return JsonResponse(data=data, safe=False)
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
const data = await response.json() const data = await response.json()
tweetsList.innerHTML += data.html; tweetsList.innerHTML += data.html;
if (btn.getAttribute('data-page') === data.last_page) { btn.hide() } if (!data.has_next) { btn.style.display = 'none'; }
const dataPage = parseInt(btn.getAttribute('data-page')) + 1 const dataPage = parseInt(btn.getAttribute('data-page')) + 1
btn.setAttribute('data-page', dataPage) btn.setAttribute('data-page', dataPage)
......
...@@ -120,8 +120,7 @@ ...@@ -120,8 +120,7 @@
}) })
const data = await response.json() const data = await response.json()
searchArticleResultWrapper.innerHTML += data.html; searchArticleResultWrapper.innerHTML += data.html;
if (btn.getAttribute('data-page') === data.last_page) if (!data.has_next) { btn.style.display = 'none'; }
btn.hide();
btn.setAttribute('data-page', parseInt(btn.getAttribute('data-page')) + 1) btn.setAttribute('data-page', parseInt(btn.getAttribute('data-page')) + 1)
} }
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment