pyfedi/app/templates/admin/communities.html
2025-01-02 15:29:29 +01:00

133 lines
8.9 KiB
HTML

{% 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_communities' %}
{% block app_content %}
<div class="row">
<div class="col">
<h1>{{ title }}</h1>
<div class="row">
<div class="col">
<form id="searchCommunities" method="get">
<input type="search" name="search" placeholder="{{ _('Search') }}" value="{{ search }}">
<input type="submit" name="submit" value="Search">
</form>
Result Filter:
<a href="{{ url_for('admin.admin_communities') }}">All</a> |
<a href="{{ url_for('admin.admin_communities_no_topic') }}">No topic</a>
</div>
<div class="col-auto">
<div class="btn-group">
<a href="{{ url_for('community.add_local') }}" class="btn btn-outline-secondary" aria-label="{{ _('Create local community') }}">{{ _('Create local community') }}</a>
<a href="{{ url_for('community.add_remote') }}" class="btn btn-outline-secondary" aria-label="{{ _('Add community from another instance') }}">{{ _('Add remote community') }}</a>
</div>
</div>
</div>
<div class="table-responsive-md mt-4">
<table class="communities_table table table-striped table-hover w-100">
<tr>
<th>
<button form="searchCommunities" name="sort_by" value="title{{' DESC' if sort_by == 'title ASC' else ' ASC' }}" class="btn" title="{{ _('Sort by name') }}">
{{ _('Community') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'title DESC' }}{{ 'fe fe-chevron-down' if sort_by == 'title ASC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="topic_id{{' ASC' if sort_by == 'topic_id DESC' else ' DESC' }}" class="btn" title="{{ _('Topic') }}">
{{ _('Topic') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'topic_id ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'topic_id DESC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="post_count{{' ASC' if sort_by == 'post_count DESC' else ' DESC' }}" class="btn" title="{{ _('Sort by post count') }}">
{{ _('Posts') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'post_count ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'post_count DESC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="subscriptions_count{{' ASC' if sort_by == 'subscriptions_count DESC' else ' DESC' }}" class="btn" title="{{ _('Number of known subscribers') }}">
{{ _('Members') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'subscriptions_count ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'subscriptions_count DESC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="content_retention{{' ASC' if sort_by == 'content_retention DESC' else ' DESC' }}" class="btn" title="{{ _('Content retention duration') }}">
{{ _('Retention') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'content_retention ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'content_retention DESC' }}"></span>
</button>
</th>
<th>{{ _('Layout') }}</th>
<th>
<button form="searchCommunities" name="sort_by" value="show_popular{{' ASC' if sort_by == 'show_popular DESC' else ' DESC' }}" class="btn" title="{{ _('Posts can be popular.') }}">
{{ _('Popular') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'show_popular ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'show_popular DESC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="show_all{{' ASC' if sort_by == 'show_all DESC' else ' DESC' }}" class="btn" title="{{ _('Posts show in the All feed.') }}">
{{ _('All') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'show_all ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'show_all DESC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="{{'nsfl ASC, nsfw ASC' if sort_by == 'nsfl DESC, nsfw DESC' else 'nsfl DESC, nsfw DESC' }}" class="btn" title="{{ _('Content warning, NSFW or NSFL set for community.') }}">
{{ _('Warning') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'nsfl ASC, nsfw ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'nsfl DESC, nsfw DESC' }}"></span>
</button>
</th>
<th>
<button form="searchCommunities" name="sort_by" value="last_active{{' ASC' if sort_by == 'last_active DESC' else ' DESC' }}" class="btn" title="{{ _('Sort by recent activity') }}">
{{ _('Active') }}
<span class="{{ 'fe fe-chevron-up' if sort_by == 'last_active ASC' }}{{ 'fe fe-chevron-down' if sort_by == 'last_active DESC' }}"></span>
</button>
</th>
<th>{{ _('Actions') }}</th>
</tr>
{% for community in communities.items %}
<tr>
<td>{{ render_communityname(community, add_domain=False) }}{% if community.banned %} (banned){% endif %}<br />
!<a href="/c/{{ community.link() }}">{{ community.name }}</a><wbr />@<a href="{{ community.ap_profile_id }}">{{ community.ap_domain }}</a></td>
<td><span title="{{ _('Topic') }}">{{ community.topic.name }}</span></td>
<td><span title="{{ _('Number of posts') }}">{{ community.post_count }}</span></td>
<td><span title="{{ _('Number of known subscribers') }}">{{ community.subscriptions_count }}</span></td>
<td><span title="{{ _('Content retention duration') }}">{{ community.content_retention if community.content_retention != -1 }}</span></td>
<td><span title="{{ _('Layout') }}">{{ community.default_layout if community.default_layout }}</span></td>
<td><span title="{{ _('Posts can be popular.') }}">{{ '&check;'|safe if community.show_popular else '&cross;'|safe }}</span></td>
<td><span title="{{ _('Posts show in the All feed.') }}">{{ '&check;'|safe if community.show_all else '&cross;'|safe }}</span></td>
<td><span title="{{ _('Content warning, NSFW or NSFL set for community.') }}">{{ '&#x26A0;'|safe if community.nsfw or community.nsfl or community.content_warning else ''|safe }}</span></td>
<td><span title="{{ _('Last activity') }}">{{ arrow.get(community.last_active).humanize(locale=locale) }}</span></td>
<td><a href="{{ url_for('admin.admin_community_edit', community_id=community.id) }}">{{ _('Edit') }}</a>,
<a href="{{ url_for('community.community_moderate', actor=community.link()) }}">{{ _('Moderate') }}</a>,
<a href="{{ url_for('admin.admin_community_delete', community_id=community.id) }}" class="confirm_first">{{ _('Delete') }}</a>
</td>
</tr>
{% endfor %}
</table>
</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>
</div>
</div>
<hr />
<div class="row">
<div class="col">
{% include 'admin/_nav.html' %}
</div>
</div>
<hr />
{% endblock %}