combine all admin content templates

This commit is contained in:
Hendrik L 2024-12-28 00:04:20 +01:00
parent dd75c88189
commit 7d19893473
4 changed files with 34 additions and 112 deletions

View file

@ -1205,7 +1205,9 @@ def admin_content():
next_url = url_for('admin.admin_content', page=posts.next_num) if posts.has_next else None
prev_url = url_for('admin.admin_content', page=posts.prev_num) if posts.has_prev and page != 1 else None
return render_template('admin/content.html', title=_('Bad posts'), next_url=next_url, prev_url=prev_url, posts=posts,
return render_template('admin/content.html', title=_('Bad posts'),
next_url=next_url, prev_url=prev_url,
posts=posts, post_replies=None,
moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()),
menu_topics=menu_topics(),
@ -1240,7 +1242,7 @@ def admin_content_spam():
next_url_replies = url_for('admin.admin_content_spam', replies_page=post_replies.next_num) if post_replies.has_next else None
prev_url_replies = url_for('admin.admin_content_spam', replies_page=post_replies.prev_num) if post_replies.has_prev and replies_page != 1 else None
return render_template('admin/spam_posts.html', title=_('Likely spam'),
return render_template('admin/content.html', title=_('Likely spam'),
next_url=next_url, prev_url=prev_url,
next_url_replies=next_url_replies, prev_url_replies=prev_url_replies,
posts=posts, post_replies=post_replies,
@ -1274,7 +1276,7 @@ def admin_content_deleted():
next_url_replies = url_for('admin.admin_content_deleted', replies_page=post_replies.next_num) if post_replies.has_next else None
prev_url_replies = url_for('admin.admin_content_deleted', replies_page=post_replies.prev_num) if post_replies.has_prev and replies_page != 1 else None
return render_template('admin/deleted_posts.html', title=_('Deleted content'),
return render_template('admin/content.html', title=_('Deleted content'),
next_url=next_url, prev_url=prev_url,
next_url_replies=next_url_replies, prev_url_replies=prev_url_replies,
posts=posts, post_replies=post_replies,

View file

@ -9,10 +9,13 @@
{% block app_content %}
<div class="row">
<div class="col">
<h1>{{ _('Most downvoted posts in the last 3 days') }}</h1>
<h1>{{ title }}</h1>
{% if post_replies %}<h2 class="mt-4" id="comments">Posts</h2>{% endif %}
<div class="post_list">
{% for post in posts.items %}
{% include 'post/_post_teaser.html' %}
{% else %}
<p>{{ _('No posts.') }}</p>
{% endfor %}
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
@ -27,6 +30,31 @@
</a>
{% endif %}
</nav>
{% if post_replies %}
<h2 class="mt-4" id="comments">Comments</h2>
<div class="post_list">
{% for post_reply in post_replies.items %}
{% with teaser=True, disable_voting=True, no_collapse=True, show_deleted=True %}
{% include 'post/_post_reply_teaser.html' %}
{% endwith %}
<hr />
{% else %}
<p>{{ _('No comments.') }}</p>
{% endfor %}
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
{% if prev_url_replies %}
<a href="{{ prev_url_replies }}" class="btn btn-primary">
<span aria-hidden="true">&larr;</span> {{ _('Previous page') }}
</a>
{% endif %}
{% if next_url_replies %}
<a href="{{ next_url_replies }}" class="btn btn-primary">
{{ _('Next page') }} <span aria-hidden="true">&rarr;</span>
</a>
{% endif %}
</nav>
{% endif %}
</div>
</div>
<hr />

View file

@ -1,68 +0,0 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %}
{% from 'bootstrap/form.html' import render_form %}
{% set active_child = 'admin_content_deleted' %}
{% block app_content %}
<div class="row">
<div class="col">
<h1>{{ _('Deleted posts') }}</h1>
<div class="post_list">
{% for post in posts.items %}
{% include 'post/_post_teaser.html' %}
{% else %}
<p>{{ _('No deleted posts.') }}</p>
{% endfor %}
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
{% if prev_url %}
<a href="{{ prev_url }}" class="btn btn-primary">
<span aria-hidden="true">&larr;</span> {{ _('Previous page') }}
</a>
{% endif %}
{% if next_url %}
<a href="{{ next_url }}" class="btn btn-primary">
{{ _('Next page') }} <span aria-hidden="true">&rarr;</span>
</a>
{% endif %}
</nav>
{% if post_replies %}
<h2 class="mt-4" id="comments">Deleted comments</h2>
<div class="post_list">
{% for post_reply in post_replies.items %}
{% with teaser=True, disable_voting=True, no_collapse=True, show_deleted=True %}
{% include 'post/_post_reply_teaser.html' %}
{% endwith %}
<hr />
{% else %}
<p>{{ _('No deleted comments.') }}</p>
{% endfor %}
</div>
<nav aria-label="Pagination" class="mt-4" role="navigation">
{% if prev_url_replies %}
<a href="{{ prev_url_replies }}" class="btn btn-primary">
<span aria-hidden="true">&larr;</span> {{ _('Previous page') }}
</a>
{% endif %}
{% if next_url_replies %}
<a href="{{ next_url_replies }}" class="btn btn-primary">
{{ _('Next page') }} <span aria-hidden="true">&rarr;</span>
</a>
{% endif %}
</nav>
{% else %}
<p>{{ _('No comments yet.') }}</p>
{% endif %}
</div>
</div>
<hr />
<div class="row">
<div class="col">
{% include 'admin/_nav.html' %}
</div>
</div>
<hr />
{% endblock %}

View file

@ -1,40 +0,0 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %}
{% from 'bootstrap/form.html' import render_form %}
{% set active_child = 'admin_content_spam' %}
{% block app_content %}
<div class="row">
<div class="col">
<h1>{{ _('Most downvoted posts in the last 3 days') }}</h1>
<div class="post_list">
{% for post in posts.items %}
{% include 'post/_post_teaser.html' %}
{% endfor %}
</div>
{% if post_replies %}
<h2 class="mt-4" id="comments">Downvoted comments</h2>
<div class="post_list">
{% for post_reply in post_replies.items %}
{% with teaser=True, disable_voting=True, no_collapse=True, show_deleted=True %}
{% include 'post/_post_reply_teaser.html' %}
{% endwith %}
<hr />
{% endfor %}
</div>
{% else %}
<p>{{ _('No comments yet.') }}</p>
{% endif %}
</div>
</div>
<hr />
<div class="row">
<div class="col">
{% include 'admin/_nav.html' %}
</div>
</div>
<hr />
{% endblock %}