mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
admin - communities with no topic
This commit is contained in:
parent
f19cdfafad
commit
153ac96084
3 changed files with 24 additions and 1 deletions
|
@ -232,6 +232,28 @@ def admin_communities():
|
|||
site=g.site)
|
||||
|
||||
|
||||
@bp.route('/communities/no-topic', methods=['GET'])
|
||||
@login_required
|
||||
@permission_required('administer all communities')
|
||||
def admin_communities_no_topic():
|
||||
|
||||
page = request.args.get('page', 1, type=int)
|
||||
search = request.args.get('search', '')
|
||||
|
||||
communities = Community.query.filter(Community.topic_id == None)
|
||||
if search:
|
||||
communities = communities.filter(Community.title.ilike(f"%{search}%"))
|
||||
communities = communities.order_by(Community.title).paginate(page=page, per_page=1000, error_out=False)
|
||||
|
||||
next_url = url_for('admin.admin_communities_no_topic', page=communities.next_num) if communities.has_next else None
|
||||
prev_url = url_for('admin.admin_communities_no_topic', page=communities.prev_num) if communities.has_prev and page != 1 else None
|
||||
|
||||
return render_template('admin/communities.html', title=_('Communities with no topic'), next_url=next_url, prev_url=prev_url,
|
||||
communities=communities, moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id()),
|
||||
site=g.site)
|
||||
|
||||
|
||||
@bp.route('/community/<int:community_id>/edit', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@permission_required('administer all communities')
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1>{{ _('Communities') }}</h1>
|
||||
<h1>{{ title }}</h1>
|
||||
<form method="get">
|
||||
<input type="search" name="search"> <input type="submit" name="submit" value="Search">
|
||||
</form>
|
||||
|
|
|
@ -191,6 +191,7 @@
|
|||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_site' }}" href="{{ url_for('admin.admin_site') }}">{{ _('Site profile') }}</a></li>
|
||||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_misc' }}" href="{{ url_for('admin.admin_misc') }}">{{ _('Misc settings') }}</a></li>
|
||||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_communities' }}" href="{{ url_for('admin.admin_communities') }}">{{ _('Communities') }}</a></li>
|
||||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_communities' }}" href="{{ url_for('admin.admin_communities_no_topic') }}">{{ _('Communities - no topic') }}</a></li>
|
||||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_topics' }}" href="{{ url_for('admin.admin_topics') }}">{{ _('Topics') }}</a></li>
|
||||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_users' }}" href="{{ url_for('admin.admin_users', local_remote='local') }}">{{ _('Users') }}</a></li>
|
||||
<li><a class="dropdown-item{{ ' active' if active_child == 'admin_users_trash' }}" href="{{ url_for('admin.admin_users_trash', local_remote='local') }}">{{ _('Monitoring - users') }}</a></li>
|
||||
|
|
Loading…
Add table
Reference in a new issue