diff --git a/assets/locales/en/translation.json b/assets/locales/en/translation.json index e4a0c5ffa6..b34fbc39dd 100644 --- a/assets/locales/en/translation.json +++ b/assets/locales/en/translation.json @@ -754,5 +754,9 @@ "oidc-user-doesnt-exist-in-tenant": "User account from identity provider does not exist in tenant. The account needs to be added as an external user in the tenant first.", "oidc-user-doesnt-exist-in-tenant-detail": "For email {{-email}} and url {{-url}} and tenant {{-name}}", "lang-en": "English", - "lang-mri": "Māori" + "lang-mri": "Māori", + "system-message-enabled": "false", + "system-message-title": "System Notification", + "system-message-description": "ReDBox will be unavailable from 9am to 12pm on October 20 for system upgrades. Please contact support for any help" + } diff --git a/assets/styles/default-theme.scss b/assets/styles/default-theme.scss index a8b670ef95..690cee2a5c 100644 --- a/assets/styles/default-theme.scss +++ b/assets/styles/default-theme.scss @@ -192,6 +192,11 @@ z-index: 999; padding: 80px 0 130px; } +#system-message-area { + padding-top: 80px; + display: none; + } + .site-branding-area { background-color: $site-branding-area-background; } diff --git a/views/default/default/layout.ejs b/views/default/default/layout.ejs index 1686765b6e..859c14c698 100644 --- a/views/default/default/layout.ejs +++ b/views/default/default/layout.ejs @@ -115,6 +115,16 @@ <% if (typeof title!== 'undefined') { %> <% } %> +<% if (TranslationService.t('system-message-enabled') == 'true') { %> +
+ +
+ <% } %> +
<%- body %>
@@ -155,6 +165,33 @@ curHref.closest('li').addClass('active').closest('.dropdown').addClass('site-branding-area'); } } + + const storedsystemMessageDismissalTime = parseInt(localStorage.getItem('systemMessageDismissalTime'), 10); + + if (storedsystemMessageDismissalTime) { + const currentsystemMessageDismissalTime = Date.now(); + const eightHoursInMillis = 8 * 60 * 60 * 1000; // 8 hours in milliseconds + if (currentsystemMessageDismissalTime - storedsystemMessageDismissalTime > eightHoursInMillis) { + //Already been dismissed in the past 8 hours so close it + $('#system-message-area').show() + } else { + //remove the system message area as it takes up space even when hidden + const systemMessageArea = document.getElementById('system-message-area'); + systemMessageArea.parentNode.removeChild(systemMessageArea) + } + } else { + $('#system-message-area').show() + } + + $('#system-message').on('closed.bs.alert', function () { + + const currentEpochMillis = Date.now(); + + localStorage.setItem('systemMessageDismissalTime', currentEpochMillis.toString()); + //remove the system message area as it takes up space even when hidden + const systemMessageArea = document.getElementById('system-message-area'); + systemMessageArea.parentNode.removeChild(systemMessageArea) + }) });