From c653c5df90dec03e2230966d0ea522c8e46c5242 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Sat, 6 Mar 2021 09:28:44 +0100 Subject: [PATCH] Change alerts to toasts, add bootstrap's js libs --- auth/assets/public/script.js | 20 ++++++++++--------- .../templates/authorized-clients.html.tpl | 2 -- .../assets/templates/change-password.html.tpl | 2 -- auth/assets/templates/inc_alerts.html.tpl | 5 ----- auth/assets/templates/inc_footer.html.tpl | 3 +++ auth/assets/templates/inc_toasts.html.tpl | 16 +++++++++++++++ auth/assets/templates/login.html.tpl | 2 -- .../oauth2-authorize-client.html.tpl | 3 --- .../password-reset-requested.html.tpl | 1 - .../pending-email-confirmation.html.tpl | 1 - auth/assets/templates/profile.html.tpl | 2 -- .../templates/request-password-reset.html.tpl | 2 -- auth/assets/templates/reset-password.html.tpl | 2 -- auth/assets/templates/sessions.html.tpl | 2 -- auth/assets/templates/signup.html.tpl | 2 -- auth/handlers/handle_profile.go | 8 +++++++- 16 files changed, 37 insertions(+), 36 deletions(-) delete mode 100644 auth/assets/templates/inc_alerts.html.tpl create mode 100644 auth/assets/templates/inc_toasts.html.tpl diff --git a/auth/assets/public/script.js b/auth/assets/public/script.js index 2b5c5950e..0dbee26be 100644 --- a/auth/assets/public/script.js +++ b/auth/assets/public/script.js @@ -1,10 +1,12 @@ -// placeholder +$(function () { + $('.toast').toast('show'); -function buttonDisabler() { - setTimeout(function() { - let bb = document.getElementsByTagName('button') - for (let i = 0; i < bb.length; i++) { - bb[i].disabled = true - } - }, 100) -} + $('form').not('do-not-disable-buttons-on-submit').on('submit', function() { + let form = this + setTimeout(function() { + $('button, input[type=submit]', form) + .not('do-not-disable-on-submit') + .attr('disabled', true) + }, 50) + }) +}) diff --git a/auth/assets/templates/authorized-clients.html.tpl b/auth/assets/templates/authorized-clients.html.tpl index 0ae4c7989..deeed68e3 100644 --- a/auth/assets/templates/authorized-clients.html.tpl +++ b/auth/assets/templates/authorized-clients.html.tpl @@ -1,12 +1,10 @@ {{ template "inc_header.html.tpl" set . "activeNav" "clients" }}
- {{ template "inc_alerts.html.tpl" .alerts }}

Authorized clients

diff --git a/auth/assets/templates/change-password.html.tpl b/auth/assets/templates/change-password.html.tpl index b49847756..5d59c460c 100644 --- a/auth/assets/templates/change-password.html.tpl +++ b/auth/assets/templates/change-password.html.tpl @@ -1,11 +1,9 @@ {{ template "inc_header.html.tpl" set . "activeNav" "security" }}
- {{ template "inc_alerts.html.tpl" .alerts }}

Change your password

{{ .csrfField }} diff --git a/auth/assets/templates/inc_alerts.html.tpl b/auth/assets/templates/inc_alerts.html.tpl deleted file mode 100644 index 5b6ea6d74..000000000 --- a/auth/assets/templates/inc_alerts.html.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{{ range . }} - -{{ end }} diff --git a/auth/assets/templates/inc_footer.html.tpl b/auth/assets/templates/inc_footer.html.tpl index e8113b80b..d4433a6c4 100644 --- a/auth/assets/templates/inc_footer.html.tpl +++ b/auth/assets/templates/inc_footer.html.tpl @@ -1,4 +1,5 @@ + {{ template "inc_toasts.html.tpl" .alerts }} {{ if .user }}
You're logged-in as @@ -15,5 +16,7 @@ version {{ version }} + + diff --git a/auth/assets/templates/inc_toasts.html.tpl b/auth/assets/templates/inc_toasts.html.tpl new file mode 100644 index 000000000..41ad1dfd2 --- /dev/null +++ b/auth/assets/templates/inc_toasts.html.tpl @@ -0,0 +1,16 @@ +
+{{ range . }} + +{{ end }} +
diff --git a/auth/assets/templates/login.html.tpl b/auth/assets/templates/login.html.tpl index 71ef824e1..77ddb8c56 100644 --- a/auth/assets/templates/login.html.tpl +++ b/auth/assets/templates/login.html.tpl @@ -1,11 +1,9 @@ {{ template "inc_header.html.tpl" . }}
- {{ template "inc_alerts.html.tpl" .alerts }}

Log in

{{ if .settings.LocalEnabled }} diff --git a/auth/assets/templates/oauth2-authorize-client.html.tpl b/auth/assets/templates/oauth2-authorize-client.html.tpl index e82f957a8..93b0375c4 100644 --- a/auth/assets/templates/oauth2-authorize-client.html.tpl +++ b/auth/assets/templates/oauth2-authorize-client.html.tpl @@ -1,8 +1,6 @@ {{/* setting hideNav=true to root scope and passign it to header template */}} {{ template "inc_header.html.tpl" set . "hideNav" true }}
- {{ template "inc_alerts.html.tpl" .alerts }} - {{ if .invalidUser }}