Compare commits
1 Commits
Frontend
...
8be441bab9
| Author | SHA1 | Date | |
|---|---|---|---|
| 8be441bab9 |
6
init.py
6
init.py
@ -5,6 +5,7 @@ from flask_talisman import Talisman
|
||||
from get_mysql import get_mysql
|
||||
import atexit
|
||||
from flask_apscheduler import APScheduler
|
||||
from turbo_flask import Turbo
|
||||
|
||||
|
||||
def create():
|
||||
@ -13,6 +14,7 @@ def create():
|
||||
:return app:
|
||||
"""
|
||||
app = Flask(__name__)
|
||||
turbo.init_app(app)
|
||||
dbpw = get_mysql()[1]
|
||||
dbun = get_mysql()[0]
|
||||
|
||||
@ -70,10 +72,10 @@ class Meals(db.Model):
|
||||
|
||||
|
||||
scheduler = APScheduler()
|
||||
turbo = Turbo()
|
||||
app = create()
|
||||
def_src = ["*.paulmartin.cloud", '\'self\'']
|
||||
Talisman(app, content_security_policy={"default-src": def_src, "script-src": def_src # + ["'unsafe-inline'"]
|
||||
})
|
||||
# Talisman(app, content_security_policy={"default-src": def_src, "script-src": def_src # + ["'unsafe-inline'"]})
|
||||
scheduler.init_app(app)
|
||||
scheduler.start()
|
||||
scheduler.api_enabled = True
|
||||
|
||||
16
routing.py
16
routing.py
@ -23,10 +23,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():
|
||||
"""
|
||||
@ -46,6 +50,14 @@ def welcome():
|
||||
else:
|
||||
t = "hidden"
|
||||
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)
|
||||
|
||||
|
||||
|
||||
@ -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>
|
||||
<ul id = "navbar-items">
|
||||
{% 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>
|
||||
<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("welcome", sel="theorie") }}>Theorie</a></li>
|
||||
<li class="top selected"><a class="top selected" href={{ url_for("welcome", sel="praxis") }}>Praxis</a></li>
|
||||
<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("welcome", sel="theorie") }}>Theorie</a></li>
|
||||
<li class="top"><a class="top" href={{ url_for("welcome", sel="praxis") }}>Praxis</a></li>
|
||||
<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 %}
|
||||
<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>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<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>
|
||||
|
||||
@ -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
21
templates/noten-list.html
Normal 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>      {{ e }}</h2>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@ -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>      {{ 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 ("setSemester", next=url_for("displayNoten")) }}>
|
||||
|
||||
Reference in New Issue
Block a user