Mercurial Hosting > chat
diff src/account.html.luan @ 20:dade6a560494
add dialogs
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Nov 2024 21:37:58 -0700 |
parents | e22a1ba4b2ed |
children | 5a56297713a3 |
line wrap: on
line diff
--- a/src/account.html.luan Mon Nov 04 19:23:38 2024 -0700 +++ b/src/account.html.luan Mon Nov 04 21:37:58 2024 -0700 @@ -20,6 +20,19 @@ <html> <head> <% head() %> + <script> + 'use strict'; + + function deleteUser() { + let dialog = document.querySelector('dialog[delete_user]'); + openModal(dialog); + } + + function doDeleteUser(el) { + closeModal(el); + ajax('delete_user.js'); + } + </script> </head> <body> <% header() %> @@ -27,9 +40,17 @@ <h1>Your Account</h1> <p><a href="chat.html">Your Chats</a></p> <p>Your URL: <%= base_url() %>/chat.html?with=<%=user.email%></p> - <p><a href="javascript:ajax('delete_user.js')">Delete account</a></p> + <p><a href="javascript:deleteUser()">Delete account</a></p> <p><a href="javascript:logout()">Logout</a></p> </div> + <dialog delete_user> + <h2>Delete Account</h2> + <p>Are you sure that you want to delete your account?</p> + <div buttons> + <button cancel onclick="closeModal(this)">Cancel</button> + <button go onclick="doDeleteUser(this)">Delete</button> + </div> + </dialog> </body> </html> <%