Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Trending pagination param getting dropped #253

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions django_wtf/templates/core/components/pagination.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
{% load paginator_tags user_agents %}
<div class="mt-5 mb-5 self-center btn-group">
{% if page_obj.has_previous %}<a href="?page={{ page_obj.previous_page_number }}" class="btn">«</a>{% endif %}
{% if request|is_mobile or request|is_tablet %}
{% get_proper_elided_page_range paginator page_obj.number 1 1 as page_range %}
{% else %}
{% get_proper_elided_page_range paginator page_obj.number 2 2 as page_range %}
{% endif %}
{% for page_number in page_range %}
{% if page_number == page_obj.paginator.ELLIPSIS %}
<a class="btn btn-disabled">...</a>
{% with request.GET.trending as trending %}
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}{% if trending %}&trending={{ trending }}{% endif %}"
class="btn">«</a>
{% endif %}
{% if request|is_mobile or request|is_tablet %}
{% get_proper_elided_page_range paginator page_obj.number 1 1 as page_range %}
{% else %}
<a href="?page={{ page_number }}"
class="btn {% if page_number == page_obj.number %}btn-active{% endif %}">{{ page_number }}</a>
{% get_proper_elided_page_range paginator page_obj.number 2 2 as page_range %}
{% endif %}
{% for page_number in page_range %}
{% if page_number == page_obj.paginator.ELLIPSIS %}
<a class="btn btn-disabled">...</a>
{% else %}
<a href="?page={{ page_number }}{% if trending %}&trending={{ trending }}{% endif %}"
class="btn {% if page_number == page_obj.number %}btn-active{% endif %}">{{ page_number }}</a>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}{% if trending %}&trending={{ trending }}{% endif %}"
class="btn">»</a>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}<a href="?page={{ page_obj.next_page_number }}" class="btn">»</a>{% endif %}
{% endwith %}
</div>
Loading