-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes our Django template `confirmation_modal.html` and instead provides the `confirmation-modal` custom element. The new modal is used like a submit button for HTML forms. Alternatively, if a modal does not have an associated form, it will dispatch a custom "confirmed" event on itself. Additionally, I added "custom-success" forms. By specifying the `custom-success` tag on an HTML form, the form will not use the default behavior when a submit is requested, but instead submit the form data with `fetch` and dispatch a custom event afterwards. One common use case is making a form reload the current site on success - this way, we don't need the views to know what sites usually request it. I added the `reload-on-success` tag for this special case. I changed all confirmation modals, except for the delegation modal on the contributor index site. This modal was already a special case before and we can port it later.
- Loading branch information
1 parent
8145c09
commit 04015c9
Showing
30 changed files
with
846 additions
and
665 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 was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
evap/evaluation/templates/confirmation_modal_template.html
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,33 @@ | ||
{% load static %} | ||
|
||
<template id="confirmation-modal-template"> | ||
<link rel="stylesheet" href="{% static 'css/evap.css' %}" /> | ||
|
||
<dialog class="evap-modal-dialog"> | ||
<form method="dialog"> | ||
<div class="evap-modal-container"> | ||
<header> | ||
<h5 class="mb-0"><slot name="title"></slot></h5> | ||
<button class="btn-close"></button> | ||
</header> | ||
<section class="question-area"> | ||
<slot name="question"></slot> | ||
<slot name="extra-inputs"></slot> | ||
</section> | ||
<section class="button-area"> | ||
<button class="btn btn-light" autofocus>{% trans 'Cancel' %}</button> | ||
<slot name="submit-group"> | ||
<button class="btn ms-2" data-event-type="confirm"> | ||
<slot name="action-text"></slot> | ||
</button> | ||
</slot> | ||
</section> | ||
</div> | ||
</form> | ||
</dialog> | ||
|
||
<slot name="show-button"></slot> | ||
|
||
{# All children without the "slot" attribute go into this unnamed slot #} | ||
<slot></slot> | ||
</template> |
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,9 @@ | ||
{% load static %} | ||
|
||
{% include "confirmation_modal_template.html" %} | ||
|
||
<script type="module"> | ||
import { ConfirmationModal } from "{% static 'js/confirmation-modal.js' %}"; | ||
|
||
customElements.define("confirmation-modal", ConfirmationModal); | ||
</script> |
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
Oops, something went wrong.