POC: Replace foundation modals with HTMX templates and utilities #3454
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Scope and purpose
Implements part of #3449, part of meta #2972.
This PR replaces modals used in the Add/Remove Patch modals in the SeedDB tool. It is an inital POC of how modals could be implemented with reusable utilities.
Add a description of what this PR does and why it is needed. If a linked ticket(s) fully
cover it, you can omit this.
The implementation takes a "functional approach", where the rendering is controlled and configured in the views. I tried using a "dialog" element, but it is very heavily styled and modifed by foundation css and js. As such, I opted for a
role="dialog"for now.Closing of the modal/updating is handled by utilities, where
hx-swap-oobis used to update other parts of the UI together with the main response.This pull request
render_modal: Renders a given template inside an HTMX modalresolve_modal: Resolves modal by closing it and returning an optional template (which can be replaced with hx-target attributes)render_modal_alert: Adds a given error message to the alert section of the modal.seeddb_add_patch.jswith htmx enabled views for showing modals and updating the DOM after successful saving of patches.Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.