From a355423ff7566ff1d38bfa1627ec5b7ffa4b6bdc Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Wed, 16 Oct 2024 23:57:24 +0200 Subject: Cleaned up the layout a bit --- templates/controls.j2 | 10 +++++++++- templates/index.j2 | 35 +++++++++++++++-------------------- templates/macros.j2 | 4 ++-- 3 files changed, 26 insertions(+), 23 deletions(-) (limited to 'templates') diff --git a/templates/controls.j2 b/templates/controls.j2 index 1799e01..8e190c5 100644 --- a/templates/controls.j2 +++ b/templates/controls.j2 @@ -1,3 +1,5 @@ +{% from "macros.j2" import court %} +

Controls

@@ -48,4 +50,10 @@ hx-target="#games">Reset
-
+
+
+{% for key, value in courts.items() %} + {{ court(key, value) }} +{% endfor %} +
+
\ No newline at end of file diff --git a/templates/index.j2 b/templates/index.j2 index fcea4e3..22c72a0 100644 --- a/templates/index.j2 +++ b/templates/index.j2 @@ -11,29 +11,24 @@
- -
-
+
+
+
+ +

Games

- {% include 'controls.j2' %} -
-
-

Courts

-
+

Players

diff --git a/templates/macros.j2 b/templates/macros.j2 index 7117d11..65d886f 100644 --- a/templates/macros.j2 +++ b/templates/macros.j2 @@ -1,7 +1,7 @@ {% macro court(id, status) -%} + hx-swap="outerHTML"> Court {{ id }} {%- endmacro %} {% macro player(id, status, name) -%} @@ -18,6 +18,6 @@ {% macro timer(mins, secs) -%}
-

Timer: {{mins}}:{{secs}}

+

⏲️ {{mins}}:{{secs}}

{%- endmacro %} \ No newline at end of file -- cgit v1.3.1 From fb6b013b821e2011a04d6ba85813a6a947c14239 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Thu, 17 Oct 2024 00:01:05 +0200 Subject: Removed debug statements and old template --- app.py | 6 ++++-- model.py | 2 -- templates/courts.j2 | 8 -------- 3 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 templates/courts.j2 (limited to 'templates') diff --git a/app.py b/app.py index 2421ee9..d7d3b65 100644 --- a/app.py +++ b/app.py @@ -40,12 +40,14 @@ def get_guests(): @app.route("/decrement", methods=["POST"]) def increment_guests(): - return render_template("guests.j2", guests=rg.players.decrement_guests()) + t = re.from_string('{% from "macros.j2" import guests %}{{guests(count)}}') + return render_template(t, count=rg.players.decrement_guests()) @app.route("/increment", methods=["POST"]) def decrement_guests(): - return render_template("guests.j2", guests=rg.players.increment_guests()) + t = re.from_string('{% from "macros.j2" import guests %}{{guests(count)}}') + return render_template(t, count=rg.players.increment_guests()) @app.route("/propose", methods=["POST"]) diff --git a/model.py b/model.py index c69ba48..904265f 100644 --- a/model.py +++ b/model.py @@ -131,6 +131,4 @@ class Timer: return self.default mins = f"{int(total_seconds // 60):02d}" secs = f"{int(total_seconds % 60):02d}" - print(mins) - print(secs) return mins, secs diff --git a/templates/courts.j2 b/templates/courts.j2 deleted file mode 100644 index d650298..0000000 --- a/templates/courts.j2 +++ /dev/null @@ -1,8 +0,0 @@ -{% from "macros.j2" import court %} -
-
-{% for key, value in courts.items() %} - {{ court(key, value) }} -{% endfor %} -
-
\ No newline at end of file -- cgit v1.3.1 From e627108b44bb069b556a11b1b2581b5a87209066 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Thu, 17 Oct 2024 10:55:33 +0200 Subject: Moved the player activation to a separate page --- templates/controls.j2 | 1 - templates/index.j2 | 21 +++++++++--------- templates/players.j2 | 59 ++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 62 insertions(+), 19 deletions(-) (limited to 'templates') diff --git a/templates/controls.j2 b/templates/controls.j2 index 8e190c5..7a03f9a 100644 --- a/templates/controls.j2 +++ b/templates/controls.j2 @@ -1,5 +1,4 @@ {% from "macros.j2" import court %} -

Controls

diff --git a/templates/index.j2 b/templates/index.j2 index 22c72a0..8ff9eb1 100644 --- a/templates/index.j2 +++ b/templates/index.j2 @@ -19,20 +19,21 @@
-
-

Match Up!

+

+ Games +

+
+

Match Up!

+

+ Players +

-
+
-
-

Games

-
-
-
-

Players

-
+
+