Go to file
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
cmd/numerus Implement login cookie, its verification, and logout 2023-01-17 20:58:13 +01:00
debian Convert invoices to PDF with WeasyPrint 2023-02-26 17:26:09 +01:00
demo Replace tag relations with array attributes 2023-04-07 21:31:35 +02:00
deploy Replace tag relations with array attributes 2023-04-07 21:31:35 +02:00
pkg Allow editing invoice tags inline from the index table 2023-04-11 10:46:27 +02:00
po Improve translations to avoid from and to date confusion 2023-03-30 11:06:19 +02:00
revert Replace tag relations with array attributes 2023-04-07 21:31:35 +02:00
test Replace tag relations with array attributes 2023-04-07 21:31:35 +02:00
verify Replace tag relations with array attributes 2023-04-07 21:31:35 +02:00
web Allow editing invoice tags inline from the index table 2023-04-11 10:46:27 +02:00
.gitignore Ignore IntelliJ’s project files 2023-01-30 16:42:15 +01:00
COPYING Rename LICENSE to COPYING 2023-01-15 04:08:35 +01:00
Makefile Rename extension of templates to .gohtml 2023-01-30 16:48:21 +01:00
go.mod Properly register array and composite PostgreSQL types with pgtype 2023-02-20 11:42:21 +01:00
go.sum Fix use of API methods not available in Go 1.16 2023-02-13 10:32:26 +01:00
sqitch.conf Setup authentication schema and user relation 2023-01-13 20:30:21 +01:00
sqitch.plan Replace tag relations with array attributes 2023-04-07 21:31:35 +02:00