Update the admin panel to show the article counters.

main
KKlochko 1 year ago
parent 75b7d84806
commit 657d58d15f

@ -8,7 +8,12 @@
<div class="flex-1 flex items-center space-x-2">
<h5>
<span class="text-gray-500">All articles:</span>
<span class="dark:text-white">123456</span>
<span class="dark:text-white"
x-data="{ count: document.getElementById('articles').children.length }"
x-on:htmx:load.window="count = document.getElementById('articles').children.length"
@delete_row.window="count = document.getElementById('articles').children.length"
x-text="count">
</span>
</h5>
</div>
</div>
@ -60,7 +65,12 @@
<nav class="flex flex-col md:flex-row justify-between items-start md:items-center space-y-3 md:space-y-0 p-4" aria-label="Table navigation">
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">
Showing
<span class="font-semibold text-gray-900 dark:text-white">123456</span>
<span class="font-semibold text-gray-900 dark:text-white"
x-data="{ count: document.getElementById('articles').children.length }"
x-on:htmx:load.window="count = document.getElementById('articles').children.length"
@delete_row.window="count = document.getElementById('articles').children.length"
x-text="count">
</span>
</span>
</nav>
</div>
@ -107,6 +117,7 @@
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">Are you sure you want to delete this article?</h3>
<button id="confirmDeleteButton"
x-init="$watch('deleteId', () => htmx.process(htmx.find('#confirmDeleteButton')))"
@click="$dispatch('delete_row');"
hx-swap="outerHTML"
x-bind:hx-delete="`/htmx/admin/rows/article/${deleteId}`"
x-bind:hx-target="`#row-${deleteId}`"

Loading…
Cancel
Save