From 267ce0188a42ab6a85614301948cfec6527e6e03 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Wed, 13 Apr 2022 20:18:45 +0200 Subject: [PATCH 001/111] Fix error page that appears when logging out of the admin panel --- application/app/templates/baseLayout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/app/templates/baseLayout.html b/application/app/templates/baseLayout.html index 22ff47c..1ef2823 100644 --- a/application/app/templates/baseLayout.html +++ b/application/app/templates/baseLayout.html @@ -30,7 +30,7 @@
- {% if user.is_authenticated or "accounts/login/" in request.path or "accounts/logout/" in request.path %} + {% if user.is_authenticated or "accounts/login/" in request.path or "accounts/logout/" in request.path or "admin/logout/" in request.path %}

{% block heading %}{% endblock %}

From 3f0a0d79d0a69f7571f73a12c1b8e47abb2c22f4 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Wed, 13 Apr 2022 20:36:24 +0200 Subject: [PATCH 002/111] Do a bit of refactoring in the bootstrap script --- lib/bootstrap.py | 239 ++++++++++++++++++++++++----------------------- 1 file changed, 124 insertions(+), 115 deletions(-) diff --git a/lib/bootstrap.py b/lib/bootstrap.py index 84944b1..5f9fd23 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -12,117 +12,16 @@ from sys import stdout from sys import stderr -# devel or prod? +# some vars devel = False - -try: - if argv[1] == "devel": - devel = True -except IndexError: - pass +caddy_process = None +scs_process = None +app_process = None -# vars -pwd = getcwd() - -APPLICATION_LOG = environ["APPLICATION_LOG"] -CADDY_ACCESS_LOG = environ["CADDY_ACCESS_LOG"] -CADDY_LOG = environ["CADDY_LOG"] - -DJANGO_PORT = environ["DJANGO_PORT"] -HTTPS_PORT = environ["HTTPS_PORT"] - -if devel: - environ["DJANGO_DEBUG"] = "true" -else: - environ["DJANGO_DEBUG"] = "false" - - -# info - -print(f"\n\nStarting server on port {HTTPS_PORT}...\nYou should be able to access the application locally at https://localhost:{HTTPS_PORT}/\n\nPress Ctrl+C to stop all services.\n\n") -if not devel: - print(f"All further messages will be written to {APPLICATION_LOG} and {CADDY_LOG}") -print(f"HTTP Access Log will be written to {CADDY_ACCESS_LOG}") - - -try: - - # start django/uvicorn - - if devel: - run( - ["python3", f"{pwd}/application/manage.py", "collectstatic", "--noinput"], - stdout=stdout, - stderr=stderr, - env=environ - ) - app_process = Popen( - ["python3", f"{pwd}/application/manage.py", "runserver", f"localhost:{DJANGO_PORT}"], - stdout=stdout, - stderr=stderr, - env=environ - ) - else: - application_log_file = open(APPLICATION_LOG, "a") - run( - ["python3", f"{pwd}/application/manage.py", "collectstatic", "--noinput"], - stdout=application_log_file, - stderr=application_log_file, - env=environ - ) - app_process = Popen( - [ - "python3", "-m", "uvicorn", - "--host", "localhost", - "--port", quote(DJANGO_PORT), - "drinks_manager.asgi:application" - ], - stdout=application_log_file, - stderr=application_log_file, - cwd=f"{pwd}/application/", - env=environ - ) - - # start caddy - - if devel: - caddy_log_file = stdout - caddy_log_file_stderr = stderr - else: - caddy_log_file = caddy_log_file_stderr = open(CADDY_LOG, "a") - - caddy_process = Popen( - ["caddy", "run", "--config", f"{pwd}/config/Caddyfile"], - stdout=caddy_log_file, - stderr=caddy_log_file_stderr, - env=environ - ) - - # start session-clear-scheduler - - if devel: - clear_sched_log_file = stdout - clear_sched_log_file_stderr = stderr - else: - clear_sched_log_file = clear_sched_log_file_stderr = open(APPLICATION_LOG, "a") - - scs_process = Popen( - ["python3", f"{pwd}/lib/session-clear-scheduler.py"], - stdout=clear_sched_log_file, - stderr=clear_sched_log_file_stderr - ) - - caddy_process.wait() - scs_process.wait() - app_process.wait() - - -except KeyboardInterrupt: - - # exit +def stop(): print("\n\nStopping services.\n\n") @@ -130,19 +29,129 @@ except KeyboardInterrupt: scs_process.send_signal(SIGINT) app_process.send_signal(SIGINT) - caddy_process.wait() - print(f"Caddy stopped with exit code {caddy_process.returncode}.") - - scs_process.wait() - print(f"session-clear-scheduler stopped with exit code {scs_process.returncode}.") - - app_process.wait() + print(f"Caddy stopped with exit code {caddy_process.wait()}.") + + print(f"session-clear-scheduler stopped with exit code {scs_process.wait()}.") + if devel: - print(f"Django stopped with exit code {app_process.returncode}.") + print(f"Django stopped with exit code {app_process.wait()}.") else: - print(f"Django/Uvicorn stopped with exit code {app_process.returncode}.") + print(f"Django/Uvicorn stopped with exit code {app_process.wait()}.") if caddy_process.returncode != 0 or scs_process.returncode != 0 or app_process.returncode !=0: exit(1) else: exit(0) + + + +if __name__ == "__main__": + + # development or production environment? + try: + if argv[1] == "devel": + devel = True + except IndexError: + pass + + + # vars + + pwd = getcwd() + + APPLICATION_LOG = environ["APPLICATION_LOG"] + CADDY_ACCESS_LOG = environ["CADDY_ACCESS_LOG"] + CADDY_LOG = environ["CADDY_LOG"] + + DJANGO_PORT = environ["DJANGO_PORT"] + HTTPS_PORT = environ["HTTPS_PORT"] + + if devel: + environ["DJANGO_DEBUG"] = "true" + else: + environ["DJANGO_DEBUG"] = "false" + + + # info + + print(f"\n\nStarting server on port {HTTPS_PORT}...\nYou should be able to access the application locally at https://localhost:{HTTPS_PORT}/\n\nPress Ctrl+C to stop all services.\n\n") + if not devel: + print(f"All further messages will be written to {APPLICATION_LOG} and {CADDY_LOG}") + print(f"HTTP Access Log will be written to {CADDY_ACCESS_LOG}") + + + try: + + # start django/uvicorn + + if devel: + run( + ["python3", f"{pwd}/application/manage.py", "collectstatic", "--noinput"], + stdout=stdout, + stderr=stderr, + env=environ + ) + app_process = Popen( + ["python3", f"{pwd}/application/manage.py", "runserver", f"localhost:{DJANGO_PORT}"], + stdout=stdout, + stderr=stderr, + env=environ + ) + else: + application_log_file = open(APPLICATION_LOG, "a") + run( + ["python3", f"{pwd}/application/manage.py", "collectstatic", "--noinput"], + stdout=application_log_file, + stderr=application_log_file, + env=environ + ) + app_process = Popen( + [ + "python3", "-m", "uvicorn", + "--host", "localhost", + "--port", quote(DJANGO_PORT), + "drinks_manager.asgi:application" + ], + stdout=application_log_file, + stderr=application_log_file, + cwd=f"{pwd}/application/", + env=environ + ) + + # start caddy + + if devel: + caddy_log_file = stdout + caddy_log_file_stderr = stderr + else: + caddy_log_file = caddy_log_file_stderr = open(CADDY_LOG, "a") + + caddy_process = Popen( + ["caddy", "run", "--config", f"{pwd}/config/Caddyfile"], + stdout=caddy_log_file, + stderr=caddy_log_file_stderr, + env=environ + ) + + # start session-clear-scheduler + + if devel: + clear_sched_log_file = stdout + clear_sched_log_file_stderr = stderr + else: + clear_sched_log_file = clear_sched_log_file_stderr = open(APPLICATION_LOG, "a") + + scs_process = Popen( + ["python3", f"{pwd}/lib/session-clear-scheduler.py"], + stdout=clear_sched_log_file, + stderr=clear_sched_log_file_stderr + ) + + caddy_process.wait() + scs_process.wait() + app_process.wait() + + + except KeyboardInterrupt: + + stop() From a9c5ec34fc422bb21ab5070bf8fd65d261da04d7 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Mon, 18 Apr 2022 16:33:22 +0200 Subject: [PATCH 003/111] Add dependency information for Ubuntu --- docs/Setup.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/Setup.md b/docs/Setup.md index a2b701a..f42ba70 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -8,12 +8,13 @@ Before the actual setup, you have to satisfy the following dependencies: ### System - `pg_config` - - Fedora/RHEL: `libpq-dev` + - Fedora/RHEL/Ubuntu: `libpq-dev` - `Caddy` 2.4.3+ (HTTP Reverse Proxy & Static File Server) - `gcc`, `gettext` - `Python` 3.9 with pip - `Python` header files - Fedora/RHEL: `python3-devel` + - Ubuntu: `python3-dev` ### Python Packages (pip) From aa85ac5ffc5fbb25c83e5a08e1e330ad2eaa0448 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Mon, 18 Apr 2022 17:00:12 +0200 Subject: [PATCH 004/111] Removed the command 'run-script' and added the command 'shell', and updated the docs and README --- README.md | 6 ++---- docs/Commands.md | 33 +++++++++++++++++++-------------- lib/run-script.sh | 21 --------------------- lib/start-django-shell.sh | 12 ++++++++++++ run.sh | 10 +++++----- 5 files changed, 38 insertions(+), 44 deletions(-) delete mode 100644 lib/run-script.sh create mode 100644 lib/start-django-shell.sh diff --git a/README.md b/README.md index cd12fbf..e557514 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,5 @@ The releases are versioned after the following scheme: `MAJOR`.`MINOR` -- `MAJOR`: will include changes - -> may be incompatible with the previous version -- `MINOR`: will only include bugfixes and smaller changes - -> may not be incompatible with the previous version +- `MAJOR`: may include **breaking changes** and/or significant new features +- `MINOR`: will only include bugfixes and smaller, **non-breaking changes** diff --git a/docs/Commands.md b/docs/Commands.md index ff0cee2..b47bbc3 100644 --- a/docs/Commands.md +++ b/docs/Commands.md @@ -10,55 +10,60 @@ You run a command with --- -`server` - Start the server -This starts a caddy instance, uvicorn with the django application and a scheduler that automatically removes expired session data. +### `server` +This starts the application (a caddy instance, uvicorn with the Django application and a scheduler that automatically removes expired session data). Log files will be written. --- -`setup` - Set up the application +### `setup` This sets up some database tables, views, and more, generates a secret key for the application and lets you create an admin user. --- -`create-admin` - Lets you create an admin user +### `create-admin` +Lets you create an admin user --- -`generate-secret-key` - generate a new random secret key for django +### `generate-secret-key` +Generate a new random secret key for Django. This will overwrite the old one. Warning: After running this, current sessions will be invalid, and the users have to relogin. Don't run this command while the server is running. --- -`clear-sessions` - manually remove all expired sessions from the database +### `clear-sessions` +manually remove all expired sessions from the database --- -`force-db-upgrade` - force a database migration and -upgrade +### `force-db-upgrade` +force a database migration and -upgrade. This is mainly used in development. --- -`archive-tables` - archive (copy & delete) all entries in app_order and app_registertransaction +### `archive-tables` +archive (copy & delete) all entries in app_order and app_registertransaction. Use this to archive old orders or transactions (e.g. when the database gets too big). --- -`development-server` - Start the development server -This starts a caddy instance, the django development server with DEBUGGING enabled and the session-clear-scheduler. +### `development-server` +This starts a caddy instance, the Django development server with DEBUGGING enabled and the session-clear-scheduler. Only the HTTP-Access-Log will be written to its logfile, other logs will be written to the console. --- -`run-script ` - Run a python script in the context of the django project (experimental) -`` is the path to the python script +### `shell` -Keep in mind that the current directory won't be changed automatically to the parent folder of the script file. +Start a Django shell. --- -`help` - Show a help text +### `help` +Show a help text --- diff --git a/lib/run-script.sh b/lib/run-script.sh deleted file mode 100644 index ffc4ece..0000000 --- a/lib/run-script.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# run a script in the context of the django project - -export DJANGO_DEBUG="true" - -if [ -z $2 ]; then - - echo "Missing second argument : the path to the script" - -else - - oldcwd="$(pwd)" - script_path=$2 - echo "Starting $2 in a django shell:" - echo -e "--------------------------------------------------------------------------------\n" - cat "$script_path" | "$(pwd)/application/manage.py" shell - echo -e "\n--------------------------------------------------------------------------------" - cd "$oldcwd" - -fi diff --git a/lib/start-django-shell.sh b/lib/start-django-shell.sh new file mode 100644 index 0000000..a696310 --- /dev/null +++ b/lib/start-django-shell.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# start a django shell + +export DJANGO_DEBUG="true" + +oldcwd="$(pwd)" +echo "Starting a django shell..." +echo -e "--------------------------------------------------------------------------------\n" +"$(pwd)/application/manage.py" shell +echo -e "\n--------------------------------------------------------------------------------" +cd "$oldcwd" \ No newline at end of file diff --git a/run.sh b/run.sh index c015033..a1664c5 100755 --- a/run.sh +++ b/run.sh @@ -8,12 +8,12 @@ function show_dm_help { # $1 = exit code echo -e " server\t\tstart server" echo -e " setup\t\t\tset up the application" echo -e " create-admin\t\tcreate an admin account" - echo -e " generate-secret-key\tgenerate a new random secret key for django" + echo -e " generate-secret-key\tgenerate a new random secret key for Django" echo -e " clear-sessions\tmanually remove all expired sessions from the database" echo -e " force-db-upgrade\tforce a database migration & upgrade" echo -e " archive-tables\tarchive (copy & delete) all entries in app_order and app_registertransaction" - echo -e " development-server\tstart django development server and enable debugging" - echo -e " run-script \tRun a python script in the context of the django project (experimental)" + echo -e " development-server\tstart Django development server and enable debugging" + echo -e " shell\t\t\tstart a Django shell" echo -e " help\t\t\tShow this help text\n" echo -e "\nExamples:\n" echo -e " ./run.sh server" @@ -77,9 +77,9 @@ else python3 "$(pwd)/lib/archive-tables.py" - elif [ $1 = 'run-script' ]; then + elif [ $1 = 'shell' ]; then - source "$(pwd)/lib/run-script.sh" + source "$(pwd)/lib/start-django-shell.sh" elif [ $1 = 'help' ]; then From fc2bf922d275aca8e86906bb15a95386afb45653 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Mon, 18 Apr 2022 17:04:19 +0200 Subject: [PATCH 005/111] Bump version to 4.0 --- lib/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/env.sh b/lib/env.sh index 505deb1..43ec5e8 100644 --- a/lib/env.sh +++ b/lib/env.sh @@ -2,5 +2,5 @@ export DJANGO_SK_ABS_FP="$(pwd)/config/secret_key.txt" export STATIC_FILES="$(pwd)/static/" -export APP_VERSION="3.0" +export APP_VERSION="4.0" export PYTHONPATH="$(pwd)/packages/" From 9406bbad978def8e364a1574642cbc6a4d1e9a74 Mon Sep 17 00:00:00 2001 From: W13R <9070224-W13R@users.noreply.gitlab.com> Date: Sat, 14 May 2022 11:28:32 +0200 Subject: [PATCH 006/111] Revised some UI elements --- application/app/templates/baseLayout.html | 2 - application/app/templates/userPanel.html | 55 ++++++++++++----------- static/css/deposit.css | 8 ---- static/css/login.css | 1 - static/css/main.css | 49 +++++++++----------- static/css/order.css | 8 ---- 6 files changed, 51 insertions(+), 72 deletions(-) diff --git a/application/app/templates/baseLayout.html b/application/app/templates/baseLayout.html index 1ef2823..ced9bb8 100644 --- a/application/app/templates/baseLayout.html +++ b/application/app/templates/baseLayout.html @@ -22,9 +22,7 @@ {% if user.is_authenticated %} -
{% include "userPanel.html" %} -
{% endif %} diff --git a/application/app/templates/userPanel.html b/application/app/templates/userPanel.html index 61c0d9e..2ec16c2 100644 --- a/application/app/templates/userPanel.html +++ b/application/app/templates/userPanel.html @@ -1,31 +1,36 @@ {% load i18n %} -
diff --git a/app/templates/deposit.html b/app/templates/deposit.html index bbce3e1..cf3dbc1 100644 --- a/app/templates/deposit.html +++ b/app/templates/deposit.html @@ -8,20 +8,16 @@ {% block headAdditional %} - + {% endblock %} {% block content %} +

{% translate "Deposit" %}

{% csrf_token %} -

{% translate "Deposit" %}

- {% translate "Amount" %} {{ currency_suffix }}: - - - +
-
@@ -31,6 +27,7 @@
+
{% endblock %} \ No newline at end of file diff --git a/app/templates/order.html b/app/templates/order.html index 2cae204..2e5286f 100644 --- a/app/templates/order.html +++ b/app/templates/order.html @@ -11,31 +11,31 @@
{% if drink and drink.available > 0 and not drink.deleted %} {% if user.balance > 0 or user.allow_order_with_negative_balance %} +

{% translate "Order" %}

{% csrf_token %} -

{% translate "Order" %}

- {% translate "Drink" %}: + {% translate "Drink" %} {{ drink.product_name }}
- {% translate "Price per Item" %} ({{ currency_suffix }}): + {% translate "Price per Item" %} ({{ currency_suffix }}) {{ drink.price }}
{% if not drink.do_not_count %}
- {% translate "Available" %}: + {% translate "Available" %} {{ drink.available }}
{% endif %}
- {% translate "Sum" %} ({{ currency_suffix }}): + {% translate "Sum" %} ({{ currency_suffix }}) {{ drink.price }}
- {% translate "Count" %}: + {% translate "Count" %} {% if drink.do_not_count %} @@ -48,19 +48,19 @@
-
+
{% else %} -
+

{% translate "Your balance is too low to order a drink." %}

- {% translate "back" %} + {% translate "back" %}
{% endif %} {% else %} diff --git a/app/templates/registration/login.html b/app/templates/registration/login.html index c9ba292..657c713 100644 --- a/app/templates/registration/login.html +++ b/app/templates/registration/login.html @@ -10,7 +10,7 @@ {% block headAdditional %} - + {% endblock %} {% block content %} @@ -19,7 +19,7 @@ {% endif %}
-

{% translate "Log in" %}

+

{% translate "Log in" %}

{% csrf_token %} @@ -36,7 +36,7 @@
-
+

{% translate "Choose your account" %}

    {% for user_ in user_list %} diff --git a/app/templates/supply.html b/app/templates/supply.html index 4f656c2..bcbc3d0 100644 --- a/app/templates/supply.html +++ b/app/templates/supply.html @@ -9,27 +9,21 @@ {% block content %} {% if user.is_superuser or user.allowed_to_supply %} +

    {% translate "Supply" %}

    {% csrf_token %} -

    {% translate "Supply" %}

    - {% translate "Description" %}: - - - +
    - {% translate "Price" %} ({{ currency_suffix }}): - - - +
    -
    +
    {% else %} diff --git a/app/templates/transfer.html b/app/templates/transfer.html index 74c13f4..bf0524b 100644 --- a/app/templates/transfer.html +++ b/app/templates/transfer.html @@ -8,44 +8,37 @@ {% block headAdditional %} - + {% endblock %} {% block content %} +

    {% translate "Transfer Money" %}

    {% csrf_token %} -

    {% translate "Transfer Money" %}

    - {% translate "Recipient" %}: - - + + {% for user_ in user_list %} + {% if user_.id != user.id %} + - {% endfor %} - - + {{ user_.first_name }} + {% elif user_.last_name %} + {{ user_.last_name }} + {% else %} + {{ user_.username }} + {% endif %} + {% endif %} + + {% endfor %} +
    - {% translate "Amount" %} {{ currency_suffix }}: - - - +
    -
    @@ -55,6 +48,7 @@
+
{% endblock %} \ No newline at end of file diff --git a/app/templates/userpanel.html b/app/templates/userpanel.html index 7d2d015..966f86e 100644 --- a/app/templates/userpanel.html +++ b/app/templates/userpanel.html @@ -18,19 +18,20 @@ {% translate "Deposit" %} {% translate "Logout" %}
-
\ No newline at end of file +
diff --git a/static/css/main.css b/static/css/main.css index a6bcf52..ea44432 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,4 +1,4 @@ -/* Font */ +/* Fonts */ @font-face { font-family: "Inter"; @@ -18,26 +18,37 @@ :root { --font-family: "Inter"; --color: #fafafa; - --color-error: #ff682c; - --bg-page: linear-gradient(#18151a, #060a0e); - --bg-color: #ffffff2c; + --color-disabled: #ffffff50; + --color-error: #ff817c; + --bg-page: linear-gradient( + -10deg, + #071c29 10%, + #4a8897 + ); + --bg-color: #ffffff35; + --bg-color2: #ffffff25; --bg-hover-color: #ffffff50; - --bg-color2: #ffffff44; - --bg-dropdown-color: #3a3a3f; - --bg-dropdown-hover-color: #59595c; - --border-color: #ffffff67; + --border-color: #ffffff50; --bg-globalmessage: #161616; - --border-radius: .25rem; + --border-radius: .6rem; + --element-padding: .6rem .8rem; } /* General */ +body, +input, +select, +button, .button +{ + font-family: var(--font-family); +} + body { margin: 0; padding: 0; width: 100vw; min-height: 100vh; - font-family: var(--font-family); font-size: 17px; background: var(--bg-page); color: var(--color); @@ -67,29 +78,36 @@ input[type="number"]::-webkit-inner-spin-button { display: none; } -input[type="text"], input[type="password"], input[type="number"], select { - padding: .5rem .8rem; - text-align: center; +input[type="text"], +input[type="password"], +input[type="number"], +select { + padding: var(--element-padding); + text-align: center !important; font-size: 16px; color: var(--color); border: none; outline: none; - border-bottom: 1px solid var(--border-color); + border: 1px solid var(--border-color); border-radius: var(--border-radius); background: var(--bg-color); - font-family: "Inter"; +} + +input[type="text"]::placeholder, +input[type="password"]::placeholder, +input[type="number"]::placeholder, +select > option:disabled { + color: var(--color-disabled); } select { appearance: none; -webkit-appearance: none; -moz-appearance: none; - height: 2.2rem; background-image: url("/static/material-icons/arrow-drop-down.svg"); background-repeat: no-repeat; background-position: right; background-size: 1.5rem; - padding-right: 1.8rem; } table { @@ -108,12 +126,6 @@ tr:nth-child(2n+2) > td { background: var(--bg-color2); } -/* -Rounded corners on table cells apparently don't work with -Firefox, so Firefox users won't have rounded corners -on tables. Can't fix that by myself. -*/ - table tr:first-child th:first-child { border-top-left-radius: var(--border-radius); } @@ -274,15 +286,6 @@ main { gap: 1rem; } -.fill { - height: 100%; - width: 100%; -} - -.fill-vertical { - height: 100%; -} - .buttons { display: flex; flex-direction: row; @@ -295,24 +298,26 @@ main { display: flex; align-items: center; justify-content: center; - font-family: var(--font-family); - text-decoration: none; - text-align: center !important; - background: var(--bg-color); - color: var(--color); - font-size: 16px; - padding: .5rem .8rem; outline: none; - border: none; - border-bottom: 1px solid var(--border-color); + border: 1px solid var(--border-color); border-radius: var(--border-radius); - cursor: pointer; - user-select: none; - box-sizing: content-box; width: fit-content; } -.button:hover, button:hover, .button:active, button:active { +.button, button, .dropdownchoice { + padding: var(--element-padding); + font-size: 16px; + text-align: center !important; + text-decoration: none; + color: var(--color); + box-sizing: content-box; + cursor: pointer; + user-select: none; + background: var(--bg-color); +} + +.button:hover, button:hover, +.button:active, button:active { background: var(--bg-hover-color); } @@ -320,30 +325,55 @@ main { opacity: 40%; } -.appform > .forminfo { - width: 100%; +.formheading { + margin-bottom: 2rem; +} + +.forminfo { + width: fit-content; + min-width: 16rem; text-align: left; display: flex; flex-direction: row; justify-content: space-between; gap: 2rem; + padding-bottom: .15rem; + border-bottom: 1px solid #ffffff20; } .forminfo > span:last-child { float: right; } +.appform, .appform > * { + max-width: 90vw; +} + .appform > .forminput { width: 100%; flex-direction: row; justify-content: space-between; - align-items: flex-end; + align-items: center; flex-wrap: wrap; gap: 1rem; } -.appform > .statusinfo { - margin-top: .5rem; +.forminput > input, .forminput > select { + width: 100% !important; +} + +.forminput > .keyboard-input, #transfer-recipient { + /* the keyboard has a 5px padding */ + margin-left: 5px !important; + margin-right: 5px !important; +} + +.appform > .buttons { + margin-top: 1rem; +} + +#statusinfo { + margin-top: 1rem; } .dropdownmenu { @@ -354,6 +384,16 @@ main { border-radius: var(--border-radius); } +#dropdownnope { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + margin: 0; + padding: 0; +} + .dropdownbutton { z-index: 190; } @@ -368,64 +408,65 @@ main { position: absolute; display: flex; flex-direction: column; - pointer-events: none; - gap: .5rem; + border-radius: var(--border-radius); + box-shadow: 0 0 .5rem #00000025; +} + +.dropdownlist, #dropdownnope { + visibility: hidden; opacity: 0%; + pointer-events: none; +} + +.dropdownvisible .dropdownlist, +.dropdownvisible #dropdownnope { + opacity: 100%; + background: #00000020; + visibility: visible; + pointer-events: visible; + z-index: 100; } .dropdownchoice { z-index: 200; - border-radius: var(--border-radius) !important; margin: 0; - text-align: center; - justify-content: center; - background: var(--bg-dropdown-color) !important; + text-decoration: none; width: initial; - box-shadow: 0 0 1.5rem #00000090; + min-width: max-content; + border-bottom: 1px solid var(--border-color); + border-left: 1px solid var(--border-color); + border-right: 1px solid var(--border-color); +} + +.dropdownchoice:first-child { + border-top: 1px solid var(--border-color); + border-top-left-radius: var(--border-radius); + border-top-right-radius: var(--border-radius); +} + +.dropdownchoice:last-child { + border-bottom: 1px solid var(--border-color); + border-bottom-left-radius: var(--border-radius); + border-bottom-right-radius: var(--border-radius); } .dropdownchoice:hover { - background: var(--bg-dropdown-hover-color) !important; -} - -.dropdownlist :first-child { - border-top-left-radius: var(--border-radius) !important; - border-top-right-radius: var(--border-radius) !important; -} - -.dropdownlist :last-child { - border-bottom-left-radius: var(--border-radius) !important; - border-bottom-right-radius: var(--border-radius) !important; -} - -.dropdownvisible .dropdownlist { - opacity: 100%; - visibility: visible; - pointer-events: visible; + background: var(--bg-hover-color); } .customnumberinput { height: 2.2rem; + display: flex; + flex-direction: row; + align-items: center; + gap: .25rem; } .customnumberinput button { - min-width: 2.5rem !important; - width: 2.5rem !important; + width: 2.2rem !important; + height: 2.2rem !important; padding: 0; margin: 0; - height: 100%; -} - -.customnumberinput-minus { - border-bottom-right-radius: 0; - border-top-right-radius: 0; - z-index: 10; -} - -.customnumberinput-plus { - border-bottom-left-radius: 0; - border-top-left-radius: 0; - z-index: 10; } .customnumberinput input[type="number"] { @@ -434,13 +475,13 @@ main { padding: 0; margin: 0; background: var(--bg-color2); - border-radius: 0 !important; -webkit-appearance: textfield; -moz-appearance: textfield; appearance: textfield; } .errortext { + font-weight: bold; color: var(--color-error); } @@ -450,6 +491,11 @@ main { /* Login */ +.userlist-container { + flex-grow: 1; + padding-bottom: 10vh; +} + .userlist { width: 60%; list-style: none; @@ -459,8 +505,7 @@ main { } .userlist > li { - margin-bottom: .5rem; - padding: 0 .5rem; + padding: .1rem .6rem; } .userlist > li > img { @@ -485,6 +530,18 @@ main { margin-top: 0; } +#passwordoverlay-container { + position: fixed; + width: 100vw; + height: 100vh; + top: 0; + right: 0; + background: var(--bg-page); + align-items: center; + padding-top: 10vh; + z-index: 200; +} + /* Drinks List */ .drinks-list { @@ -524,12 +581,13 @@ main { /* Blur */ @supports (backdrop-filter: blur()) { - :root { - --bg-dropdown-color: var(--bg-color); - --bg-dropdown-hover-color: var(--bg-hover-color); + .dropdownvisible #dropdownnope { + backdrop-filter: blur(16px); } - .dropdownchoice { - backdrop-filter: blur(32px); + #passwordoverlay-container { + background: #00000020; + backdrop-filter: blur(64px); /* fallback */ + backdrop-filter: blur(128px); } } @@ -553,9 +611,10 @@ main { } } -@media only screen and (max-width: 700px) { +@media only screen and (max-width: 860px) { .userpanel { flex-direction: column; + gap: 1rem; } .userlist { gap: 0.25rem; @@ -574,7 +633,10 @@ main { } .dropdownlist { width: 14rem; - right: calc(50vw - 7rem); + right: calc(50vw - 7rem); /* regard width */ left: auto; } + #keyboard { + display: none !important; + } } diff --git a/static/css/simple-keyboard_dark.css b/static/css/simple-keyboard_custom.css similarity index 86% rename from static/css/simple-keyboard_dark.css rename to static/css/simple-keyboard_custom.css index ffee807..39da287 100644 --- a/static/css/simple-keyboard_dark.css +++ b/static/css/simple-keyboard_custom.css @@ -15,8 +15,8 @@ align-items: center; background: var(--bg-color); color: white; - border: none; - border-bottom: 1px solid var(--border-color); + border: 1px solid var(--border-color); + border-radius: var(--border-radius); } .simple-keyboard.darkTheme .hg-button:active, .simple-keyboard.darkTheme .hg-button:hover { diff --git a/static/js/login.js b/static/js/login.js index cc9274d..6f62216 100644 --- a/static/js/login.js +++ b/static/js/login.js @@ -35,6 +35,7 @@ function show_password_overlay() { window.scrollTo(0, 0); passwordOverlayElement.classList.remove("nodisplay"); + passwordInputElement.focus() } function hide_password_overlay() { passwordOverlayElement.classList.add("nodisplay"); diff --git a/static/js/main.js b/static/js/main.js index 711aed8..5fab451 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,14 +1,21 @@ document.addEventListener("DOMContentLoaded", () => { let dropdownmenuElement = document.getElementById("dropdownmenu"); let dropdownmenuButtonElement = document.getElementById("dropdownmenu-button"); + let dropdownmenuNopeElement = document.getElementById("dropdownnope"); + function toggleDropDown() { + if (dropdownmenuElement.classList.contains("dropdownvisible")) { + dropdownmenuElement.classList.remove("dropdownvisible"); + dropdownmenuNopeElement.classList.remove("dropdownvisible"); + } else { + dropdownmenuElement.classList.add("dropdownvisible"); + dropdownmenuNopeElement.classList.add("dropdownvisible"); + } + } if (dropdownmenuButtonElement != null) { - dropdownmenuButtonElement.addEventListener("click", () => { - if (dropdownmenuElement.classList.contains("dropdownvisible")) { - dropdownmenuElement.classList.remove("dropdownvisible"); - } - else { - dropdownmenuElement.classList.add("dropdownvisible"); - } + dropdownmenuButtonElement.addEventListener("click", toggleDropDown); + dropdownmenuNopeElement.addEventListener("click", () => { + dropdownmenuElement.classList.remove("dropdownvisible"); + dropdownmenuNopeElement.classList.remove("dropdownvisible"); }) } }); From ecae648899eaa985f8362b9e4cfbd4376226e3df Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Sun, 7 Sep 2025 22:37:53 +0200 Subject: [PATCH 111/111] Bump version to 22 --- app/templates/footer.html | 2 +- start.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/footer.html b/app/templates/footer.html index 289f81e..63b51ec 100644 --- a/app/templates/footer.html +++ b/app/templates/footer.html @@ -2,6 +2,6 @@ \ No newline at end of file diff --git a/start.sh b/start.sh index 99a6ccd..cd50964 100755 --- a/start.sh +++ b/start.sh @@ -11,6 +11,6 @@ chmod -c -R g-w,o-rwx .gitignore export PYTHONPATH="$basedir" export DJANGO_SETTINGS_MODULE="project.settings" -export APP_VERSION="21" +export APP_VERSION="22" exec ./scripts/_bootstrap.py "$@"