Add pagination to page admin

- Update blog link in bit-badger theme
This commit is contained in:
2022-05-31 08:45:45 -04:00
parent 042e1fdec7
commit ba6403dfef
4 changed files with 25 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
<h2 class="my-3">{{ page_title }}</h2>
<article>
<a href="{{ "admin/page/new/edit" | relative_link }}" class="btn btn-primary btn-sm mb-3">Create a New Page</a>
{%- assign page_count = pages | size -%}
<table class="table table-sm table-hover">
<thead>
<tr>
@@ -10,7 +11,6 @@
</tr>
</thead>
<tbody>
{%- assign page_count = pages | size -%}
{% if page_count > 0 %}
{% for pg in pages -%}
<tr>
@@ -43,6 +43,22 @@
{% endif %}
</tbody>
</table>
{% if page_nbr > 1 or page_count == 25 %}
<div class="d-flex justify-content-evenly">
<div>
{% if page_nbr > 1 %}
{%- capture prev_link %}admin/pages{{ prev_page }}{% endcapture -%}
<p><a class="btn btn-default" href="{{ prev_link | relative_link }}">&laquo; Previous</a></p>
{% endif %}
</div>
<div class="text-right">
{% if page_count == 25 %}
{%- capture next_link %}admin/pages{{ next_page }}{% endcapture -%}
<p><a class="btn btn-default" href="{{ next_link | relative_link }}">Next &raquo;</a></p>
{% endif %}
</div>
</div>
{% endif %}
<form method="post" id="deleteForm">
<input type="hidden" name="{{ csrf.form_field_name }}" value="{{ csrf.request_token }}">
</form>