numerus/web/static
jordi fita mas d20573aa99 Allow editing invoice tags inline from the index table
I use the same pattern as HTMx’s “Click to Edit” example[0], except that
my edit form is triggered by submit and by focus out of the tags input.

I could not, however, use the standard focus out event because it would
also trigger when removing a tag with the mouse, as for a moment the
remove button has the focus and the search input dispatches a bubbling
focusout.  I had to resort to a custom event for that, but i am not
happy with it.

The autofocus attribute seems to do nothing in this case, so i need to
manually change the focus to the new input with JavaScript.  However,
this means that i can not use the same input ID for all the forms
because getElementById would always return the first in document order,
changing the focus to that same element and automatically submit the
form due to focus out.  That’s why in this form i append the invoice’s
slug to the input’s ID.

Finally, this is the first time i am using an HTMx-only solution and i
needed a way to return back just the HTML for the <td>, without <title>,
breadcrumbs, or <dialog>.  In principle, the template would be the
“layout”, but then i would need to modify everything to check whether
the template file is empty, or something to that effect, so instead i
created a “standalone” template for these cases.

[0]: https://htmx.org/examples/click-to-edit/
2023-04-11 10:46:27 +02:00
..
fonts Remove unused Remixicon files 2023-01-31 13:17:51 +01:00
alpinejs@3.12.0.min.js Start “improving” the user interface with AlpineJS: tax selector 2023-03-14 18:07:38 +01:00
htmx@1.8.6.min.js Show the profile form in a dialog using HTMx 2023-03-20 13:09:52 +01:00
invoice.css Add the payment method to invoices 2023-03-05 18:50:57 +01:00
numerus.css Allow editing invoice tags inline from the index table 2023-04-11 10:46:27 +02:00
numerus.js Allow editing invoice tags inline from the index table 2023-04-11 10:46:27 +02:00
numerus.svg Clean up SVG icon 2023-01-30 16:33:49 +01:00