From b11d9d0d8e0aca2d577f94dd7a6cff526fc05216 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Fri, 25 Jul 2025 14:07:20 +0200 Subject: Removed guest control --- app/templates/macros.j2 | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'app/templates/macros.j2') diff --git a/app/templates/macros.j2 b/app/templates/macros.j2 index e08bfe1..4fe35f0 100644 --- a/app/templates/macros.j2 +++ b/app/templates/macros.j2 @@ -10,28 +10,6 @@ hx-swap="outerHTML"> {{ player.first_name + " " + player.last_name}} {%- endmacro %} -{% macro guest_control(level, value) -%} -
-
- -
-
- -
-
- -
-
-{%- endmacro %} - {% macro header(url_for) -%} -- cgit v1.3.1 From 08e4a27c0db7fc2867cce3eb6f80799148c03ba6 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Fri, 25 Jul 2025 15:30:07 +0200 Subject: Moved to a mobile friendly CSS framework --- app/__init__.py | 27 +++++++-------- app/static/custom.css | 13 ++++---- app/static/custom.js | 2 +- app/templates/controls.j2 | 83 +++++++++++++++++++++++------------------------ app/templates/games.j2 | 6 ++-- app/templates/index.j2 | 11 ++++--- app/templates/login.html | 8 ++--- app/templates/macros.j2 | 54 ++++++++---------------------- app/templates/players.j2 | 59 ++++++++++++++++----------------- 9 files changed, 121 insertions(+), 142 deletions(-) (limited to 'app/templates/macros.j2') diff --git a/app/__init__.py b/app/__init__.py index 3d3b498..639f030 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -54,19 +54,29 @@ def get_list_of_courts(): return render_template("courts.j2", courts=g.courts.all()) +def login_required(f): + @wraps(f) + def decorated_function(*args, **kwargs): + if not is_logged_in(): + response = Response("User isn't logged in!") + response.headers["HX-Redirect"] = url_for("simplelogin.login") + return response + return f(*args, **kwargs) + + return decorated_function + + @app.route("/propose", methods=["POST"]) +@login_required def get_random_games(): - if not is_logged_in(): - return redirect(url_for("login")) g.levels = int(request.form["levels"].split()[0]) g.teams = request.form["team"] == "Teams" return render_template("games.j2", games=g.propose(), title="Proposal") @app.route("/confirm", methods=["POST"]) +@login_required def confirm_games(): - if not is_logged_in(): - return redirect(url_for("simplelogin.login")) return render_template("games.j2", games=g.confirm(), title=f"Round: {g.round()}") @@ -76,15 +86,6 @@ def clear_games(): "games.j2", games=g.current_round(), title=f"Round: {g.round()}" ) -def login_required(f): - @wraps(f) - def decorated_function(*args, **kwargs): - if not is_logged_in(): - response = Response("User isn't logged in!") - response.headers["HX-Redirect"] = url_for("simplelogin.login") - return response - return f(*args, **kwargs) - return decorated_function @app.route("/reset", methods=["POST"]) @login_required diff --git a/app/static/custom.css b/app/static/custom.css index 18462d3..9992ee5 100644 --- a/app/static/custom.css +++ b/app/static/custom.css @@ -1,21 +1,20 @@ -button, input, .select, .select select { +button, input, select { width: 100%; height: 100%; } -table { - font-size: 17.5px; -} td { width: 20%; } -.center { - margin: auto; - width: 50%; +.grid { + margin-top: 20px; + margin-bottom: 20px; } .parent { display: grid; grid-column-gap: 20px; grid-row-gap: 20px; + margin-top: 20px; + margin-bottom: 20px; } @media (min-width: 800px) { .parent { diff --git a/app/static/custom.js b/app/static/custom.js index 1d36493..2c47448 100644 --- a/app/static/custom.js +++ b/app/static/custom.js @@ -3,7 +3,7 @@ let timerRunningFlag = Number(sessionStorage.getItem("timerRunningFlag")) || 0; let deadline = Number(sessionStorage.getItem("deadline")) || new Date().getTime(); let clock = 0; -function setTimer(m, s) { +window.onload += function setTimer(m, s) { let timer = document.getElementById("timer-display"); m = m < 10 ? ("0" + m) : m; s = s < 10 ? ("0" + s) : s; diff --git a/app/templates/controls.j2 b/app/templates/controls.j2 index f67f745..a8cba89 100644 --- a/app/templates/controls.j2 +++ b/app/templates/controls.j2 @@ -1,47 +1,46 @@ {% from "macros.j2" import court_button %} -
-
- {% for court in courts %} - {{ court_button(court) }} - {% endfor %} -
+

Courts

+
+{% for court in courts %} + {{ court_button(court) }} +{% endfor %}
-
-
-
- -
-
-
-
- -
-
-
- +

Generation

+
+
+
-
-
- -
-
- +
+
+
+
+ + + +
+

Timer

+
+ + + + +
\ No newline at end of file diff --git a/app/templates/games.j2 b/app/templates/games.j2 index dff1e0f..ce2a412 100644 --- a/app/templates/games.j2 +++ b/app/templates/games.j2 @@ -1,4 +1,5 @@ - +
+
@@ -18,4 +19,5 @@ {% endfor %} -
{{ title }}
\ No newline at end of file + +
\ No newline at end of file diff --git a/app/templates/index.j2 b/app/templates/index.j2 index ce0d531..8a13fa0 100644 --- a/app/templates/index.j2 +++ b/app/templates/index.j2 @@ -3,11 +3,14 @@ {{ header(url_for) }} -
- {{ navbar(url_for) }} +
{{ navbar(url_for) }}
+
+

Games

+

Controls

- {{ footer() }} -
+ +
{{ footer() }}
+ diff --git a/app/templates/login.html b/app/templates/login.html index a42f2c5..e3109b6 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -3,8 +3,8 @@ {{ header(url_for) }} -
- {{ navbar(url_for) }} +
{{ navbar(url_for) }}
+
{{ form.csrf_token }} @@ -16,8 +16,8 @@ - {{ footer() }} -
+ +
{{ footer() }}
\ No newline at end of file diff --git a/app/templates/macros.j2 b/app/templates/macros.j2 index 4fe35f0..17a2940 100644 --- a/app/templates/macros.j2 +++ b/app/templates/macros.j2 @@ -1,11 +1,11 @@ {% macro court_button(court) -%} - {%- endmacro %} {% macro player_button(player) -%} - {%- endmacro %} @@ -16,56 +16,30 @@ Match Up! - + - {%- endmacro %} {% macro footer() -%} -
Made by Karan using Flask, HTMX, Notyf and Bulma
+
Made by Karan with
{%- endmacro %} + {% macro navbar(url_for) -%} -