Add thymeleaf-htmx module: Spring Boot 4.1.2 + Thymeleaf 3.1.5 + htmx 2.0.11 CRUD UI with fragment rendering, 422 validation re-render, pagination, inline edit, delete, MockMvc tests and a Chromium check
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# request (curl notation, sent through MockMvc): curl -H 'HX-Request: true' /contacts/1/edit (Edit button)
|
||||
HTTP 200
|
||||
---- body (523 chars) ----
|
||||
<tr id="contact-1" class="editing">
|
||||
<td>
|
||||
<input name="name" value="Aarav Kulkarni">
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<input name="email" value="[email protected]">
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<input name="role" value="Developer">
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<button type="button"
|
||||
hx-include="closest tr" hx-target="closest tr" hx-swap="outerHTML" hx-put="/contacts/1">Save</button>
|
||||
<button type="button"
|
||||
hx-target="closest tr" hx-swap="outerHTML" hx-get="/contacts/1">Cancel</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
# request (curl notation, sent through MockMvc): curl -X PUT -H 'HX-Request: true' -d 'name=&email=broken&role=Architect' /contacts/1 (Save, invalid)
|
||||
HTTP 422
|
||||
---- body (625 chars) ----
|
||||
<tr id="contact-1" class="editing">
|
||||
<td>
|
||||
<input name="name" value="" class="invalid">
|
||||
<small class="error">Name is required</small>
|
||||
</td>
|
||||
<td>
|
||||
<input name="email" value="broken" class="invalid">
|
||||
<small class="error">Email must look like name@host</small>
|
||||
</td>
|
||||
<td>
|
||||
<input name="role" value="Architect">
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<button type="button"
|
||||
hx-include="closest tr" hx-target="closest tr" hx-swap="outerHTML" hx-put="/contacts/1">Save</button>
|
||||
<button type="button"
|
||||
hx-target="closest tr" hx-swap="outerHTML" hx-get="/contacts/1">Cancel</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
# request (curl notation, sent through MockMvc): curl -X PUT -H 'HX-Request: true' -d 'name=Aarav K.&[email protected]&role=Architect' /contacts/1 (Save, valid)
|
||||
HTTP 200
|
||||
---- body (382 chars) ----
|
||||
<tr id="contact-1">
|
||||
<td>Aarav K.</td>
|
||||
<td>[email protected]</td>
|
||||
<td>Architect</td>
|
||||
<td>
|
||||
<button type="button"
|
||||
hx-target="closest tr" hx-swap="outerHTML" hx-get="/contacts/1/edit">Edit</button>
|
||||
<button type="button"
|
||||
hx-target="closest tr" hx-swap="outerHTML" hx-delete="/contacts/1" hx-confirm="Delete Aarav K.?">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user