From 4cf563ce6265737cc245fb3e4e51fc94f4ad3330 Mon Sep 17 00:00:00 2001 From: s3lph Date: Sun, 1 Dec 2024 23:37:22 +0100 Subject: [PATCH] fix: missing error message when scanning an unassociated barcode --- CHANGELOG.md | 13 +++++++++++++ matemat/__init__.py | 2 +- matemat/webserver/pagelets/main.py | 2 +- templates/admin.html | 7 +++---- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5093203..41df141 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Matemat Changelog + +## Version 0.3.18 + +Fix barcode error message + +### Changes + + +- fix: missing error message when scanning an unassociated barcode + + + + ## Version 0.3.17 diff --git a/matemat/__init__.py b/matemat/__init__.py index 1736e67..ad356f7 100644 --- a/matemat/__init__.py +++ b/matemat/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.3.17' +__version__ = '0.3.18' diff --git a/matemat/webserver/pagelets/main.py b/matemat/webserver/pagelets/main.py index 478a082..f5e7556 100644 --- a/matemat/webserver/pagelets/main.py +++ b/matemat/webserver/pagelets/main.py @@ -39,7 +39,7 @@ def main_page(): redirect('/') except AuthenticationError: # Redirect to main page on token login error - redirect('/') + pass Notification.error(f'EAN code {request.params.ean} is not associated with any product.', decay=True) redirect('/') diff --git a/templates/admin.html b/templates/admin.html index c55da8b..9c98991 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -25,15 +25,14 @@ {% endblock %} {% block eanwebsocket %} + let tokeninput = document.getElementById("admin-newtoken-token"); + tokeninput.value = e.data; + tokeninput.select(); {% if authuser.is_admin %} let eaninput = document.getElementById("admin-newproduct-ean"); eaninput.value = e.data; eaninput.select(); - eaninput.scrollIntoView(); {% else %} - let tokeninput = document.getElementById("admin-newtoken-token"); - tokeninput.value = e.data; - tokeninput.select(); tokeninput.scrollIntoView(); {% endif %} {% endblock %}