feat: drop js for pagination
This commit is contained in:
parent
c1301631c4
commit
6ea5d7ba28
2 changed files with 3 additions and 33 deletions
|
@ -60,22 +60,5 @@
|
||||||
</head>
|
</head>
|
||||||
<body class="dark:text-white bg-white dark:bg-gray-900 font-sans text-gray-800">
|
<body class="dark:text-white bg-white dark:bg-gray-900 font-sans text-gray-800">
|
||||||
{{ content }}
|
{{ content }}
|
||||||
<script>
|
|
||||||
(function() {
|
|
||||||
const pagination = document.getElementById('pagination');
|
|
||||||
if (pagination) {
|
|
||||||
pagination.addEventListener('change', (event) => {
|
|
||||||
const page = parseInt(event.target.value)
|
|
||||||
if (page === 1) {
|
|
||||||
window.location.href = '/'
|
|
||||||
} else {
|
|
||||||
window.location.href = `/${
|
|
||||||
event.target.value - 1
|
|
||||||
}/`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,4 +1,3 @@
|
||||||
<!--suppress HtmlFormInputWithoutLabel -->
|
|
||||||
<nav class="flex justify-between mt-8 items-center">
|
<nav class="flex justify-between mt-8 items-center">
|
||||||
{% if pagination.href.previous %}
|
{% if pagination.href.previous %}
|
||||||
<a href="{{ pagination.href.previous }}">
|
<a href="{{ pagination.href.previous }}">
|
||||||
|
@ -14,21 +13,9 @@
|
||||||
{% heroicon "outline" "arrow-left" "Prevous" "width=20 height=20" %}
|
{% heroicon "outline" "arrow-left" "Prevous" "width=20 height=20" %}
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="text-center">
|
||||||
<div class="flex flex-row items-center">
|
{{ pagination.pageNumber | plus: 1 }} of {{ pagination.links.size }}
|
||||||
<select
|
|
||||||
id="pagination"
|
|
||||||
class="block cursor-pointer w-12 h-12 rounded-full text-white dark:text-gray-900 dark:bg-purple-400 bg-purple-600 hover:bg-purple-500 dark:hover:bg-purple-500 mr-1 focus-visible:outline-none focus-visible:bg-purple-400 appearance-none text-center"
|
|
||||||
style="text-align-last:center">
|
|
||||||
{% for pageEntry in pagination.pages %}
|
|
||||||
<option {% if page.url == pagination.hrefs[forloop.index0] %}selected{% endif %} value="{{ forloop.index }}">{{ forloop.index }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<span>
|
|
||||||
of {{ pagination.links.size }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% if pagination.href.next %}
|
{% if pagination.href.next %}
|
||||||
<a href="{{ pagination.href.next }}">
|
<a href="{{ pagination.href.next }}">
|
||||||
<button class="py-2 pl-4 dark:text-purple-400 text-purple-600 hover:text-purple-500 dark:hover:text-purple-500" aria-label="Next page">
|
<button class="py-2 pl-4 dark:text-purple-400 text-purple-600 hover:text-purple-500 dark:hover:text-purple-500" aria-label="Next page">
|
||||||
|
@ -43,4 +30,4 @@
|
||||||
{% heroicon "outline" "arrow-right" "Next" "width=20 height=20" %}
|
{% heroicon "outline" "arrow-right" "Next" "width=20 height=20" %}
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
Reference in a new issue