From 42cd3b4a0e3bf5937e07a646539f63047ba2151a Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Tue, 12 Sep 2023 11:30:27 -0600 Subject: [PATCH] Moved html to footer --- app/assets/javascripts/timeoutPopup.js | 21 ++-- app/templates/admin_template.html | 127 ++++++++++++++++--------- 2 files changed, 92 insertions(+), 56 deletions(-) diff --git a/app/assets/javascripts/timeoutPopup.js b/app/assets/javascripts/timeoutPopup.js index c331cb0f7..c52d4d462 100644 --- a/app/assets/javascripts/timeoutPopup.js +++ b/app/assets/javascripts/timeoutPopup.js @@ -1,6 +1,5 @@ (function(global) { "use strict"; - //hideTimerButtons(); const sessionTimer = document.getElementById("sessionTimer"); @@ -11,17 +10,19 @@ var difference = timeTillSessionEnd - now; var minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((difference % (1000 * 60)) / 1000); - document.getElementById("timerWarning").innerHTML = "Your session will " + + document.getElementById("timerWarning").innerHTML = "You have been inactive " + + "for too long. Please choose to stay signed in or sign out. Your session will " + "expire in " + minutes + "m " + seconds + "s "; - showTimerButtons(); + showTimer(); document.getElementById("logOutTimer").addEventListener("click", logoutByUser); document.getElementById("extendSessionTimer").addEventListener("click", extendSession); - if (difference === 0) { + if (difference < 0) { clearInterval(x); + closeTimer(); redirectToSignin(); } }, 1000); - }, 1 * 60 * 1000); + }, 60 * 1000); function redirectToSignin() { window.location.href = '/sign-in'; @@ -35,14 +36,12 @@ window.location.reload(); } - function hideTimerButtons() { - document.getElementById("logOutTimer").style.display = 'none'; - document.getElementById("extendSessionTimer").style.display = 'none'; + function showTimer() { + sessionTimer.showModal(); } - function showTimerButtons() { - sessionTimer.showModal(); - document.getElementById("extendSessionTimer").style.display = 'block'; + function closeTimer() { + sessionTimer.close(); } })(window); diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 483115985..b3c6eb36b 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -11,50 +11,47 @@ {% endblock %} {% block head %} - {% if current_user.is_authenticated %} - {% block sessionUserWarning %} -
-
-
-

- Your session will end soon. -

-
-

- You’ve been inactive for too long. Please choose to stay signed in - or sign out. Otherwise, you’ll be signed out automatically in 5 - minutes. -

-
- - -
-
-
- - {% endblock %} - {% endif %} +{# {% if current_user.is_authenticated %}#} +{# {% block sessionUserWarning %}#} +{# #} +{#
#} +{#
#} +{#

#} +{# Your session will end soon.#} +{#

#} +{#
#} +{#

#} +{#

#} +{#
#} +{# #} +{# #} +{#
#} +{#
#} +{#
#} +{# #} +{# {% endblock %}#} +{# {% endif %}#} {%- for font in font_paths %} {%- endfor %} @@ -187,7 +184,47 @@ {% endblock %} {% block footer %} - + {% if current_user.is_authenticated %} + {% block sessionUserWarning %} + +
+
+

+ Your session will end soon. +

+
+

+

+
+ + +
+
+
+ + {% endblock %} + {% endif %} {% if current_service and current_service.research_mode %} {% set meta_suffix = 'Built by the Technology Transformation Servicesresearch mode' %}