From 00c958c34d9c0ab2c2481c0dedf9d6d69867e681 Mon Sep 17 00:00:00 2001 From: SimolZimol <70102430+SimolZimol@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:18:01 +0200 Subject: [PATCH] modified: app.py new file: static/css/theme-dark.css new file: static/css/theme-light.css modified: templates/index.html modified: templates/login.html modified: templates/settings.html --- app.py | 9 +++++++-- static/css/theme-dark.css | 8 ++++++++ static/css/theme-light.css | 8 ++++++++ templates/index.html | 1 + templates/login.html | 1 + templates/settings.html | 8 ++++++++ 6 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 static/css/theme-dark.css create mode 100644 static/css/theme-light.css diff --git a/app.py b/app.py index 5a79fb7..d7b5224 100644 --- a/app.py +++ b/app.py @@ -71,7 +71,7 @@ def get_db_connection(): @app.route("/") def index(): if "username" in session: - return render_template("index.html", bot_running=bot_status()) + return render_template("index.html", bot_running=bot_status(), theme=session.get('theme', 'light')) return redirect(url_for("login")) @app.route("/login", methods=["GET", "POST"]) @@ -111,20 +111,25 @@ def settings(): if request.method == "POST": introduction = request.form.get("introduction") asknotes_introduction = request.form.get("asknotes_introduction") + theme = request.form.get("theme") # Speichern der Intros save_text_file(INTRO_FILE, introduction) save_text_file(ASKNOTES_INTRO_FILE, asknotes_introduction) + # Speichern des ausgewählten Themes in der Session + session['theme'] = theme + return redirect(url_for("settings")) # Laden der aktuellen Inhalte aus den Textdateien introduction = load_text_file(INTRO_FILE) asknotes_introduction = load_text_file(ASKNOTES_INTRO_FILE) - return render_template("settings.html", introduction=introduction, asknotes_introduction=asknotes_introduction) + return render_template("settings.html", introduction=introduction, asknotes_introduction=asknotes_introduction, theme=session.get('theme', 'light')) return redirect(url_for("login")) + @app.route("/users") def users(): """Zeigt eine Liste aller Benutzer aus der Datenbank an.""" diff --git a/static/css/theme-dark.css b/static/css/theme-dark.css new file mode 100644 index 0000000..6fee6e8 --- /dev/null +++ b/static/css/theme-dark.css @@ -0,0 +1,8 @@ +body { + background-color: #343a40; + color: #ffffff; +} + +.navbar, .card { + background-color: #495057; +} \ No newline at end of file diff --git a/static/css/theme-light.css b/static/css/theme-light.css new file mode 100644 index 0000000..914af75 --- /dev/null +++ b/static/css/theme-light.css @@ -0,0 +1,8 @@ +body { + background-color: #ffffff; + color: #000000; +} + +.navbar, .card { + background-color: #f8f9fa; +} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 2f7e584..b885e9f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,6 +3,7 @@ + Admin Panel diff --git a/templates/login.html b/templates/login.html index c47f0e7..52737d7 100644 --- a/templates/login.html +++ b/templates/login.html @@ -4,6 +4,7 @@ + Login diff --git a/templates/settings.html b/templates/settings.html index 73c36d1..6556399 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -3,6 +3,7 @@ + Settings @@ -19,6 +20,13 @@
+
+
+ +