mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-09 22:47:36 +01:00
Add clear all button to notifications page
This commit is contained in:
parent
7e80adad56
commit
52fdc8c212
@ -5,6 +5,12 @@ Notifications
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if current_user.notifications %}
|
||||||
|
<form method="post" action="{{ url_for('clear_notifications_page') }}">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||||
|
<input type="submit" value="Clear All" />
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for n in current_user.notifications %}
|
{% for n in current_user.notifications %}
|
||||||
<li><a href="{{ n.url }}">
|
<li><a href="{{ n.url }}">
|
||||||
|
@ -23,4 +23,11 @@ from app.models import *
|
|||||||
@app.route("/notifications/")
|
@app.route("/notifications/")
|
||||||
@login_required
|
@login_required
|
||||||
def notifications_page():
|
def notifications_page():
|
||||||
return render_template("notifications/list.html")
|
return render_template("notifications/list.html")
|
||||||
|
|
||||||
|
@app.route("/notifications/clear/", methods=["POST"])
|
||||||
|
@login_required
|
||||||
|
def clear_notifications_page():
|
||||||
|
current_user.notifications.clear()
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for("notifications_page"))
|
||||||
|
Loading…
Reference in New Issue
Block a user