Add generic pagination tempalte
This commit is contained in:
parent
e8538cd534
commit
a9bcda045a
25
shimatta_kenkyusho/templates/paginator.html
Normal file
25
shimatta_kenkyusho/templates/paginator.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% if paginator.has_other_pages %}
|
||||||
|
<nav aria-label="{{aria_label}}">
|
||||||
|
<ul class="pagination">
|
||||||
|
{% if paginator.has_previous %}
|
||||||
|
<li class="page-item"><a class="page-link" href="?{{get_param}}={{paginator.previous_page_number}}">«</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li class="page-item disabled"><span class="page-link">«</span></li>
|
||||||
|
{% endif %}
|
||||||
|
{% for i in paginator.paginator.page_range %}
|
||||||
|
{% if i <= paginator.number|add:5 and i >= paginator.number|add:-5 %}
|
||||||
|
{% if i == paginator.number %}
|
||||||
|
<li class="page-item active"><a class="page-link" href="?{{get_param}}={{i}}">{{i}}</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li class="page-item"><a class="page-link" href="?{{get_param}}={{i}}">{{i}}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if paginator.has_next %}
|
||||||
|
<li class="page-item"><a class="page-link" href="?{{get_param}}={{paginator.next_page_number}}">»</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li class="page-item disabled"><span class="page-link">»</span></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
@ -35,24 +35,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<nav aria-label="Storage Navigation">
|
{% include 'paginator.html' with paginator=storages get_param='storage_page' aria_label='Storage Page Navigation' %}
|
||||||
<ul class="pagination">
|
|
||||||
{% if storages.number > 1 %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.previous_page_number}}">«</a></li>
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.previous_page_number}}">{{storages.previous_page_number}}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled"><span class="page-link">«</span></li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="page-item active"><span class="page-link">{{storages.number}}</span></li>
|
|
||||||
{% if storages.paginator.num_pages > storages.number %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.next_page_number}}">{{storages.next_page_number}}</a></li>
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.next_page_number}}">»</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled"><span class="page-link">»</span></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -31,24 +31,7 @@
|
|||||||
</li></a>
|
</li></a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<nav aria-label="Low Stock Navigation">
|
{% include 'paginator.html' with paginator=low_stocks get_param='low_stock_page' aria_label='Low Stock Page Navigation' %}
|
||||||
<ul class="pagination">
|
|
||||||
{% if low_stocks.number > 1 %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.previous_page_number}}">«</a></li>
|
|
||||||
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.previous_page_number}}">{{low_stocks.previous_page_number}}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled"><span class="page-link">«</span></li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="page-item active"><span class="page-link">{{low_stocks.number}}</span></li>
|
|
||||||
{% if low_stocks.paginator.num_pages > low_stocks.number %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.next_page_number}}">{{low_stocks.next_page_number}}</a></li>
|
|
||||||
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.next_page_number}}">»</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled"><span class="page-link">»</span></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<h1>Storages</h1>
|
<h1>Storages</h1>
|
||||||
@ -65,24 +48,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<nav aria-label="Storage Navigation">
|
{% include 'paginator.html' with paginator=storages get_param='storage_page' aria_label='Storage Page Navigation'%}
|
||||||
<ul class="pagination">
|
|
||||||
{% if storages.number > 1 %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.previous_page_number}}">«</a></li>
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.previous_page_number}}">{{storages.previous_page_number}}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled"><span class="page-link">«</span></li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="page-item active"><span class="page-link">{{storages.number}}</span></li>
|
|
||||||
{% if storages.paginator.num_pages > storages.number %}
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.next_page_number}}">{{storages.next_page_number}}</a></li>
|
|
||||||
<li class="page-item"><a class="page-link" href="?storage_page={{storages.next_page_number}}">»</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="page-item disabled"><span class="page-link">»</span></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user