Some additional work done with CRUDKit. May start this over with a better design for CRUDKit.
This commit is contained in:
parent
f47fb6b505
commit
7738f1c9c2
5 changed files with 67 additions and 53 deletions
|
|
@ -56,7 +56,7 @@
|
|||
</li>
|
||||
{% else %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" hx-get="{{ _rows_url(model, page, per_page, sort, filters, fields_csv) }}" hx-target="#rows"
|
||||
<a class="page-link state-modifier" hx-get="{{ _rows_url(model, page, per_page, sort, filters, fields_csv) }}" hx-target="#rows"
|
||||
hx-swap="innerHTML" data-page="{{ page }}" {{ attrs|safe }}>
|
||||
{{ label }}
|
||||
</a>
|
||||
|
|
@ -103,18 +103,6 @@
|
|||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{# keep hidden pager-state in sync with one handler instead of inline click spam #}
|
||||
<script>
|
||||
document.currentScript?.previousElementSibling?.addEventListener?.('click', function (e) {
|
||||
const a = e.target.closest('a.page-link');
|
||||
if (!a) return;
|
||||
const targetPage = a.getAttribute('data-page');
|
||||
if (!targetPage) return;
|
||||
const inp = document.querySelector('#pager-state input[name=page]');
|
||||
if (inp) inp.value = targetPage;
|
||||
}, { capture: true });
|
||||
</script>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro form(schema, action, method="POST", obj_id=None, hx=False, csrf_token=None) -%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue