-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle 400 Bad Request on event updates (#49)
* Upgrade htmx to 1.9.10 * Fix config of htmx extensions * Add generic 400 error message element * Add 400 error handler * Drop using multi-swap extension in modal As due to some bug multi-swap and response-targets extensions do not work together. Response-targets ext is necessary for error handling and is ignored in components that use multi-swap. * Display 400 error message in event update modals
- Loading branch information
1 parent
4df5a48
commit 455f9b3
Showing
9 changed files
with
122 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<!-- HTMX Config --> | ||
<meta name="htmx-config" content='{"defaultFocusScroll":"true", "useTemplateFragments":"true"}'> | ||
<meta name="htmx-config" | ||
content='{"defaultFocusScroll":"true", "useTemplateFragments":"true", "responseTargetUnsetsError":"false"}'> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<!-- HTMX --> | ||
<script src="https://unpkg.com/[email protected].5" | ||
integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" | ||
<script src="https://unpkg.com/[email protected].10" | ||
integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" | ||
crossorigin="anonymous"></script> | ||
|
||
<!-- Tailwind CSS --> | ||
|
@@ -24,7 +24,7 @@ | |
|
||
</head> | ||
<body | ||
hx-ext="[{% block extensions %}{% endblock %}]" | ||
hx-ext="{% block extensions %}{% endblock %}" | ||
class="h-full" | ||
> | ||
{% block content %} {% endblock content %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<p | ||
class="flex-inline text-red-400" | ||
> | ||
Error: {{ err_msg }} | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,78 @@ | ||
{% include "/components/row/expanded-row.html" %} | ||
<tr | ||
class="bg-white dark:bg-gray-800 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600" | ||
id="event-accordion-row-{{ id }}" | ||
hx-get="/events/{{ id }}/collapse_row" | ||
hx-trigger="dblclick" | ||
hx-swap="multi:#event-accordion-row-{{ id }}:outerHTML,#event-details-row-{{ id }}:delete" | ||
hx-target-error="body" | ||
> | ||
|
||
<div id="update-event-{{ id }}-status-modal"> | ||
{% with padding='px-3 py-2' %} | ||
|
||
{% with color=event.color if event.color %} | ||
{% if is_selected %} | ||
{% include "/components/row/event-checked-box.html" %} | ||
{% else %} | ||
{% include "/components/row/event-unchecked-box.html" %} | ||
{% endif %} | ||
{% endwith %} | ||
|
||
|
||
|
||
{% with event=event %} | ||
{% include "/components/row/data-cells.html" %} | ||
{% endwith %} | ||
|
||
{% with id=id, color=event.color %} | ||
{% include "/components/row/collapse-btn.html" %} | ||
{% endwith %} | ||
|
||
{% endwith %} | ||
|
||
</tr> | ||
|
||
<tr | ||
id="event-details-row-{{ id }}" | ||
hx-swap-oob="outerHTML" | ||
class="bg-white border-b dark:bg-gray-900 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600" | ||
|
||
> | ||
<td colspan="100"> | ||
|
||
<div | ||
id="accordion-body-{{ id }}" | ||
aria-labelledby="event-accordion-row-{{ id }}" | ||
class="p-2 border border-b-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900"> | ||
|
||
<div | ||
class="grid grid-cols-1 content-between" | ||
> | ||
|
||
{% with id=id %} | ||
{% include "/components/accordion/event-actions-buttons.html" %} | ||
{% endwith %} | ||
|
||
<div | ||
class="flex grow-0 gap-5 justify-evenly" | ||
> | ||
<div class="flex flex-col basis-4/12"> | ||
{% with event_attr=event_attr %} | ||
{% include "/components/accordion/event-attributes.html" %} | ||
{% endwith %} | ||
</div> | ||
|
||
<div class="flex flex-col basis-8/12"> | ||
{% with id=id, event_msgs=event_msgs %} | ||
{% include "/components/accordion/event-messages-block.html" %} | ||
{% endwith %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
|
||
<div id="update-event-{{ id }}-status-modal" | ||
hx-swap-oob="delete" | ||
> | ||
</div> |