diff --git a/app/models.py b/app/models.py
index 681a433..717a1cf 100644
--- a/app/models.py
+++ b/app/models.py
@@ -40,6 +40,7 @@ class Drink(models.Model):
do_not_count = models.BooleanField(default=False)
def delete(self, *args, **kwargs):
+ # we flag the field as deleted.
self.deleted = True
super().save()
@@ -107,10 +108,9 @@ class Order(models.Model):
price_sum = models.DecimalField(max_digits=6, decimal_places=2, default=0, editable=False)
content_litres = models.DecimalField(max_digits=6, decimal_places=3, default=0, editable=False)
- # TODO: Add more comments on how and why the save & delete functions are implemented
- # address this in a refactoring issue.
-
def save(self, *args, **kwargs):
+ # saving this may affect other fields
+ # so we reimplement the save function
drink = Drink.objects.get(pk=self.drink.pk)
if self._state.adding and drink.available > 0:
if not drink.do_not_count:
@@ -126,6 +126,7 @@ class Order(models.Model):
raise ValidationError("This entry can't be changed.")
def delete(self, *args, **kwargs):
+ # when deleting, we affect other fields as well.
self.user.balance += self.price_sum
self.user.save()
drink = Drink.objects.get(pk=self.drink.pk)
diff --git a/app/templates/baselayout.html b/app/templates/baselayout.html
index 5783cf9..97ac907 100644
--- a/app/templates/baselayout.html
+++ b/app/templates/baselayout.html
@@ -25,7 +25,7 @@
{% if drink and drink.available > 0 and not drink.deleted %}
{% if user.balance > 0 or user.allow_order_with_negative_balance %}
+
+
{% else %}
-
+
{% 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 "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 %}
+
+
{% 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 %}
+
+
{% 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/data/Caddyfile b/data/Caddyfile
index 84f30f3..d790c4e 100644
--- a/data/Caddyfile
+++ b/data/Caddyfile
@@ -9,7 +9,8 @@
{$CADDY_HOSTS} {
# the tls certificates
- tls {$DATADIR}/tls/server.pem {$DATADIR}/tls/server-key.pem
+ # tls {$DATADIR}/tls/server.pem {$DATADIR}/tls/server-key.pem
+ tls internal
route {
# profile pictures
file_server /profilepictures/* {
diff --git a/scripts/_bootstrap.py b/scripts/_bootstrap.py
index 7cdee55..c162c03 100755
--- a/scripts/_bootstrap.py
+++ b/scripts/_bootstrap.py
@@ -14,7 +14,7 @@ from time import sleep
from yaml import safe_load
-banner = """ ___ _ _
+banner = r""" ___ _ _
| \ _ _ (_) _ _ | |__ ___ ___
| |) || '_|| || ' \ | / /(_-< |___|
|___/ |_| |_||_||_||_\_\/__/
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 "$@"
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");
})
}
});