Skip to content

Commit

Permalink
Merge pull request canonical#14343 from mtruj013/decouple-pagination
Browse files Browse the repository at this point in the history
Decouple cve pagination from certified pages
  • Loading branch information
mtruj013 authored Sep 26, 2024
2 parents 554bb05 + 8b35902 commit f5f1dc2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion templates/certified/search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,14 @@ <h2 class="p-heading--4">
<div class="row">
<div class="col-5">
{% with total_results=total_results, total_pages=total_pages, offset=offset, limit=limit, align="u-align--left" %}
{% include "security/cves/_pagination.html" %}
{% if offset >= total_results %}
{% set current_page = 1 %}
{% else %}
{% set current_page = ((offset / limit) + 1) | int %}
{% endif %}
{% if total_results > limit %}
{% include "shared/_pagination.html" %}
{% endif %}
{% endwith %}
</div>
<div class="col-4 u-align--right">
Expand Down
9 changes: 8 additions & 1 deletion templates/certified/shared/category-search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@ <h2 class="p-heading--4">
<div class="row">
<div class="col-5">
{% with total_results=total_results, total_pages=total_pages, offset=offset, limit=limit, align="u-align--left" %}
{% include "security/cves/_pagination.html" %}
{% if offset >= total_results %}
{% set current_page = 1 %}
{% else %}
{% set current_page = ((offset / limit) + 1) | int %}
{% endif %}
{% if total_results > limit %}
{% include "shared/_pagination.html" %}
{% endif %}
{% endwith %}
</div>
<div class="col-4 u-align--right">
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/_pagination.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="u-fixed-width">
{% if current_page and total_pages and total_pages > 1 %}
<ol class="p-pagination u-align--center">
<ol class="p-pagination {% if align %} {{ align }} {% else %} u-align--center {% endif %}">
<li class="p-pagination__item">
{% if current_page > 1 %}
{% if limit %}
Expand Down

0 comments on commit f5f1dc2

Please sign in to comment.