mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Add clear all button to notifications page
This commit is contained in:
parent
7e80adad56
commit
52fdc8c212
@ -5,6 +5,12 @@ Notifications
|
||||
{% endblock %}
|
||||
|
||||
{% 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>
|
||||
{% for n in current_user.notifications %}
|
||||
<li><a href="{{ n.url }}">
|
||||
|
@ -23,4 +23,11 @@ from app.models import *
|
||||
@app.route("/notifications/")
|
||||
@login_required
|
||||
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