2 Commits
main ... turbo

Author SHA1 Message Date
8021fdfaf8 Merge branch 'refs/heads/main' into turbo
# Conflicts:
#	init.py
2024-04-10 13:53:51 +02:00
8be441bab9 init turbo 2024-04-05 11:22:14 +02:00
5 changed files with 70 additions and 48 deletions

View File

@ -24,10 +24,14 @@ def index():
Leitet den normalen Website-Aufruf zum Login weiter.
:return HTML:
"""
return redirect(url_for("login"))
if current_user.is_authenticated:
return welcome()
else:
return login()
@app.route("/dashboard")
@app.route("/dashboard", methods=["GET", "POST"])
@login_required
def welcome():
"""
@ -47,7 +51,15 @@ def welcome():
else:
t = "hidden"
p = ""
return render_template('dashboard.html', kurs=kurs, name=name, theorie=t, praxis=p)
if turbo.can_stream():
print ("Streaming...")
return turbo.stream([
turbo.update(
render_template('dashboard.html', kurs=kurs, name=name, theorie=t, praxis=p), target="content")
])
else:
print ("Not streaming!")
return render_template('dashboard.html', kurs=kurs, name=name, theorie=t, praxis=p)
@app.route("/theorie/noten", methods=["GET", "POST"])

View File

@ -5,37 +5,38 @@
<link rel="stylesheet" type="text/css" href={{ url_for("static", filename="style.css") }}>
<meta http-equiv="refresh" content="510">
<script async src="https://analytics.paulmartin.cloud/script.js" data-website-id="459fa66e-e255-4393-8e89-ead8b1572d0d"></script>
{{ turbo() }}
{% block head %}
{% endblock %}
</head>
<body>
<nav>
<ul>
{% if theorie=="hidden" and praxis=="hidden" %}
<li class="top"><a class="top" href={{ url_for("welcome", sel="theorie") }}>Theorie</a></li>
<li class="top"><a class="top" href={{ url_for("welcome", sel="praxis") }}>Praxis</a></li>
{% elif theorie == "hidden" %}
<li class="top"><a class="top" href={{ url_for("welcome", sel="theorie") }}>Theorie</a></li>
<li class="top selected"><a class="top selected" href={{ url_for("welcome", sel="praxis") }}>Praxis</a></li>
{% else %}
<li class="top selected"><a class="top selected" href={{ url_for("welcome", sel="theorie") }}>Theorie</a></li>
<li class="top"><a class="top" href={{ url_for("welcome", sel="praxis") }}>Praxis</a></li>
{% endif %}
<li {{ theorie }}><a {% if s == "n" %} class="selected" {% endif %} href={{ url_for("displayNoten") }}>Noten</a></li>
<li {{ theorie }}><a {% if s == "p" %} class="selected" {% endif %} href={{ url_for("displayRapla") }}>Stundenplan</a></li>
<li {{ praxis }}><a {% if s == "t" %} class="selected" {% endif %} href="">To Dos</a></li>
<li><a {% if s == "s" %} class="selected" {% endif %} href={{ url_for("redKurs") }}>Konfiguration</a></li>
{% if request.endpoint %}
{% if request.endpoint[:7] != "login" %}
<li><a class="bottom" href={{ url_for("logout") }}>Log-Out</a></li>
<ul id = "navbar-items">
{% if theorie=="hidden" and praxis=="hidden" %}
<li class="top"><a class="top" href={{ url_for("index", sel="theorie") }}>Theorie</a></li>
<li class="top"><a class="top" href={{ url_for("index", sel="praxis") }}>Praxis</a></li>
{% elif theorie == "hidden" %}
<li class="top"><a class="top" href={{ url_for("index", sel="theorie") }}>Theorie</a></li>
<li class="top selected"><a class="top selected" href={{ url_for("index", sel="praxis") }}>Praxis</a></li>
{% else %}
<li class="top selected"><a class="top selected" href={{ url_for("index", sel="theorie") }}>Theorie</a></li>
<li class="top"><a class="top" href={{ url_for("index", sel="praxis") }}>Praxis</a></li>
{% endif %}
{% endif %}
</ul>
<li {{ theorie }}><a {% if s == "n" %} class="selected" {% endif %} href={{ url_for("displayNoten") }}>Noten</a></li>
<li {{ theorie }}><a {% if s == "p" %} class="selected" {% endif %} href={{ url_for("displayRapla") }}>Stundenplan</a></li>
<li {{ praxis }}><a {% if s == "t" %} class="selected" {% endif %} href="">To Dos</a></li>
<li><a {% if s == "s" %} class="selected" {% endif %} href={{ url_for("redKurs") }}>Konfiguration</a></li>
<li {% block logout %}{% endblock %}><a class="bottom" href={{ url_for("logout") }}>Log-Out</a></li>
</ul>
</nav>
<div class="cs1">
{% block content %}
{% endblock %}
</div>
<turbo-frame>
<div class="cs1" id = 'page'>
<div id="content">
{% block content %}
{% endblock %}
</div>
</div>
</turbo-frame>
</body>
</html>

View File

@ -1,4 +1,8 @@
{% extends "index.html" %}
{% block logout %}
hidden
{% endblock %}
{% block content %}
<div class="cs">
<h1>Einloggen</h1>

21
templates/noten-list.html Normal file
View File

@ -0,0 +1,21 @@
{% for i in range (semester|length) %}
{% if semester[i][1]==sel %}
<h1>Deine Noten im {{ semester[i][0] }}</h1>
{% endif %}
{% endfor %}
<br>
<br>
{% for i in noten %}
{% if i[1]|length == 1 %}
{% if i[1][0][0].isnumeric() or i[1][0][-1].isalpha()%}
<h2>{{ i[0][0] }}: {{ i[1][0] }} (Credits: {{ i[2][0] }})</h2>
{% else %}
<h2>{{ i[0][0] }}: {{ i[1][0][-3:] }} (Credits: {{ i[2][0] }})</h2>
{% endif %}
{% else %}
<h2>{{ i[0][0] }} (Credits: {{ i[2][0] }}):</h2>
{% for e in i[1] %}
<h2>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;{{ e }}</h2>
{% endfor %}
{% endif %}
{% endfor %}

View File

@ -4,27 +4,11 @@
<meta http-equiv="Refresh" content="600">
{% endblock %}
{% block content %}
{% for i in range (semester|length) %}
{% if semester[i][1]==sel %}
<h1>Deine Noten im {{ semester[i][0] }}</h1>
{% endif %}
{% endfor %}
<br>
<br>
{% for i in noten %}
{% if i[1]|length == 1 %}
{% if i[1][0][0].isnumeric() or i[1][0][-1].isalpha()%}
<h2>{{ i[0][0] }}: {{ i[1][0] }} (Credits: {{ i[2][0] }})</h2>
{% else %}
<h2>{{ i[0][0] }}: {{ i[1][0][-3:] }} (Credits: {{ i[2][0] }})</h2>
{% endif %}
{% else %}
<h2>{{ i[0][0] }} (Credits: {{ i[2][0] }}):</h2>
{% for e in i[1] %}
<h2>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;{{ e }}</h2>
{% endfor %}
{% endif %}
{% endfor %}
<turbo-frame>
<div id="noten">
{% include "noten-list.html" %}
</div>
</turbo-frame>
<br>
<br>
<form id= "dropdown" method="post" action={{ url_for ("displayNoten") }}>