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
This commit is contained in:
9
app.py
9
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."""
|
||||
|
||||
8
static/css/theme-dark.css
Normal file
8
static/css/theme-dark.css
Normal file
@@ -0,0 +1,8 @@
|
||||
body {
|
||||
background-color: #343a40;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.navbar, .card {
|
||||
background-color: #495057;
|
||||
}
|
||||
8
static/css/theme-light.css
Normal file
8
static/css/theme-light.css
Normal file
@@ -0,0 +1,8 @@
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.navbar, .card {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{ url_for('static', filename='css/theme-' + theme + '.css') }}" rel="stylesheet">
|
||||
<title>Admin Panel</title>
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{ url_for('static', filename='css/theme-' + theme + '.css') }}" rel="stylesheet">
|
||||
<title>Login</title>
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="{{ url_for('static', filename='css/theme-' + theme + '.css') }}" rel="stylesheet">
|
||||
<title>Settings</title>
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
@@ -20,6 +21,13 @@
|
||||
<label for="asknotes_introduction">Asknotes Introduction Text</label>
|
||||
<textarea id="asknotes_introduction" name="asknotes_introduction" class="form-control" rows="5">{{ asknotes_introduction }}</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="theme">Select Theme</label>
|
||||
<select id="theme" name="theme" class="form-control">
|
||||
<option value="light" {% if theme == 'light' %}selected{% endif %}>Light Theme</option>
|
||||
<option value="dark" {% if theme == 'dark' %}selected{% endif %}>Dark Theme</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-block">Save Settings</button>
|
||||
</form>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-secondary btn-block mt-3">Back to Dashboard</a>
|
||||
|
||||
Reference in New Issue
Block a user