mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22: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 }}">
|
||||
|
@ -24,3 +24,10 @@ from app.models import *
|
||||
@login_required
|
||||
def notifications_page():
|
||||
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