Use htmx for confirmation (#36)

- Remove JS confirmations
This commit is contained in:
Daniel J. Summers 2022-08-16 21:04:55 -04:00
parent f2706ee7c8
commit 2f931183f3
2 changed files with 4 additions and 45 deletions

View File

@ -335,11 +335,10 @@ let view model viewInfo =
_title s["List for Next Sunday"].Value ] [
icon "update"; rawText "  "; locStr s["List for Next Sunday"]
]
let emailPrompt = s["This will e-mail the current list to every member of your group, without further prompting. Are you sure this is what you are ready to do?"].Value
a [ _class "pt-icon-link"
_href $"/prayer-requests/email/{dtString}"
_title s["Send via E-mail"].Value
_onclick $"return PT.requests.view.promptBeforeEmail('{emailPrompt}')" ] [
_hxConfirm s["This will e-mail the current list to every member of your group, without further prompting. Are you sure this is what you are ready to do?"].Value ] [
icon "mail_outline"; rawText "  "; locStr s["Send via E-mail"]
]
a [ _class "pt-icon-link"; _href "/prayer-requests"; _title s["Maintain Prayer Requests"].Value ] [

View File

@ -13,20 +13,6 @@ this.PT = {
return false
},
/**
* Confirm, then submit a delete action
* @param {string} action The URL for the action attribute of the delete form.
* @param {string} prompt The localized prompt for confirmation.
*/
confirmDelete(action, prompt) {
if (confirm(prompt)) {
let form = document.querySelector("#DeleteForm")
form.setAttribute("action", action)
form.submit()
}
return false
},
/**
* Make fields required
* @param {string[]|string} fields The field(s) to require
@ -36,14 +22,6 @@ this.PT = {
.forEach(f => document.getElementById(f).required = true)
},
/**
* Queue an action to occur when the DOM content is loaded
* @param {Function} func The function to run once the DOM content is loaded
*/
onLoad(func) {
document.addEventListener("DOMContentLoaded", func)
},
/**
* Validation that compares the values of 2 fields and fails if they do not match
* @param {string} field1 The ID of the first field
@ -131,24 +109,6 @@ this.PT = {
}
},
/**
* Scripts for pages served by the Requests controller
*/
requests: {
/**
* Script for the request view page
*/
view: {
/**
* Prompt the user to remind them that they are about to e-mail their class
* @param {string} confirmationPrompt The text to display to the user
*/
promptBeforeEmail(confirmationPrompt) {
return confirm(confirmationPrompt)
},
},
},
/**
* Scripts for pages served by the SmallGroup controller
*/