Skip to content

Commit 00400b7

Browse files
committed
fix: pagination bug when cycling through genre pages
1 parent 8907536 commit 00400b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/helpers/application_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def pagy_nav(pagy)
4040

4141
# previous button
4242
if pagy.prev
43-
html << link_to("← Prev", url_for(page: pagy.prev), class: "glass-button px-4 py-2 rounded-lg text-white hover:bg-white/30 transition-all")
43+
html << link_to("← Prev", url_for(request.query_parameters.merge(page: pagy.prev)), class: "glass-button px-4 py-2 rounded-lg text-white hover:bg-white/30 transition-all")
4444
else
4545
html << %(<span class="px-4 py-2 rounded-lg text-white/30 cursor-not-allowed">← Prev</span>)
4646
end
@@ -52,7 +52,7 @@ def pagy_nav(pagy)
5252
if item == pagy.page
5353
html << %(<span class="glass-button px-4 py-2 rounded-lg text-blue-500 bg-white/20 font-semibold">#{item}</span>)
5454
else
55-
html << link_to(item, url_for(page: item), class: "glass-button px-4 py-2 rounded-lg text-white hover:bg-white/30 transition-all")
55+
html << link_to(item, url_for(request.query_parameters.merge(page: item)), class: "glass-button px-4 py-2 rounded-lg text-white hover:bg-white/30 transition-all")
5656
end
5757
when String
5858
html << %(<span class="px-4 py-2 text-white/50">#{item}</span>)
@@ -61,7 +61,7 @@ def pagy_nav(pagy)
6161

6262
# next button
6363
if pagy.next
64-
html << link_to("Next →", url_for(page: pagy.next), class: "glass-button px-4 py-2 rounded-lg text-white hover:bg-white/30 transition-all")
64+
html << link_to("Next →", url_for(request.query_parameters.merge(page: pagy.next)), class: "glass-button px-4 py-2 rounded-lg text-white hover:bg-white/30 transition-all")
6565
else
6666
html << %(<span class="px-4 py-2 rounded-lg text-white/30 cursor-not-allowed">Next →</span>)
6767
end

0 commit comments

Comments
 (0)