From 99382626de1cba315a566f442ec873e4caf6294a Mon Sep 17 00:00:00 2001 From: Glenn de Haan Date: Sun, 5 Jan 2025 16:18:05 +0100 Subject: [PATCH] Implemented UI_BACK_BUTTON for kiosk users to navigate to the previous page. Removed h1 to clean-up UI --- README.md | 2 ++ modules/variables.js | 1 + server.js | 2 ++ template/partials/navigation.ejs | 7 +++++++ template/voucher.ejs | 6 +----- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f3cef21..cebe3fb 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ services: TRANSLATION_DEFAULT: 'en' # Enables/disables translation debugging, when enabled only translation keys are shown TRANSLATION_DEBUG: 'false' + # Enables/disables a back-button next to the logo to go back 1 page in history (Could be used with multi-page kiosks) + UI_BACK_BUTTON: 'false' ``` ### Home Assistant Add-on diff --git a/modules/variables.js b/modules/variables.js index 32a08bc..35c21d5 100644 --- a/modules/variables.js +++ b/modules/variables.js @@ -43,6 +43,7 @@ module.exports = { logLevel: config('log_level') || process.env.LOG_LEVEL || 'info', translationDefault: config('translation_default') || process.env.TRANSLATION_DEFAULT || 'en', translationDebug: config('translation_debug') || (process.env.TRANSLATION_DEBUG === 'true') || false, + uiBackButton: config('ui_back_button') || (process.env.UI_BACK_BUTTON === 'true') || false, gitTag: process.env.GIT_TAG || 'master', gitBuild: fs.existsSync('/etc/unifi_voucher_site_build') ? fs.readFileSync('/etc/unifi_voucher_site_build', 'utf-8') : 'Development' }; diff --git a/server.js b/server.js index 1172838..d249f58 100644 --- a/server.js +++ b/server.js @@ -410,6 +410,7 @@ if(variables.serviceWeb) { info_text: req.flashMessage.message || '', error: req.flashMessage.type === 'error', error_text: req.flashMessage.message || '', + uiBackButton: variables.uiBackButton, timeConvert: time, bytesConvert: bytes, email_enabled: variables.smtpFrom !== '' && variables.smtpHost !== '' && variables.smtpPort !== '', @@ -491,6 +492,7 @@ if(variables.serviceWeb) { baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '', gitTag: variables.gitTag, gitBuild: variables.gitBuild, + uiBackButton: variables.uiBackButton, user: user, userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '', authDisabled: variables.authDisabled, diff --git a/template/partials/navigation.ejs b/template/partials/navigation.ejs index a97fab2..86218fe 100644 --- a/template/partials/navigation.ejs +++ b/template/partials/navigation.ejs @@ -2,6 +2,13 @@