2024-02-06 20:31:12 -08:00
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
2023-08-22 02:24:11 -07:00
{% from 'bootstrap5/form.html' import render_form %}
2024-02-18 18:56:56 -08:00
{% set active_child = 'list_communities' %}
2023-08-22 02:24:11 -07:00
{% block app_content %}
2023-12-21 17:05:39 -08:00
< div class = "row g-2 justify-content-between mt-2" >
2023-08-29 03:01:06 -07:00
< div class = "col-auto" >
< div class = "btn-group" >
2024-02-26 00:26:19 -08:00
< a href = "/communities" aria-label = "{{ _('All communities') }}" class = "btn {{ 'btn-primary' if request.path == '/communities' else 'btn-outline-secondary' }}" >
2023-09-05 01:25:02 -07:00
{{ _('All') }}
< / a >
2024-02-26 00:26:19 -08:00
< a href = "/communities/local" aria-label = "{{ _('Communities on this server') }}" class = "btn {{ 'btn-primary' if request.path == '/communities/local' else 'btn-outline-secondary' }}" >
2023-09-05 01:25:02 -07:00
{{ _('Local') }}
< / a >
2024-02-26 00:26:19 -08:00
< a href = "/communities/subscribed" aria-label = "{{ _('Joined communities') }}" class = "btn {{ 'btn-primary' if request.path == '/communities/subscribed' else 'btn-outline-secondary' }}" >
2024-01-04 17:09:46 -08:00
{{ _('Joined') }}
2023-09-05 01:25:02 -07:00
< / a >
2024-01-03 19:00:19 -08:00
2024-02-13 12:29:17 -08:00
< / div >
< / div >
< div class = "col-auto" >
{% if topics %}
< form method = "get" style = "display:inline;" > Topic:
< select name = "topic_id" class = "form-control-sm submit_on_change" aria-label = "{{ _('Choose a topic to filter communities by') }}" >
< option value = "0" > All< / option >
{% for topic in topics %}
< option value = "{{ topic.id }}" { { ' selected ' if topic . id = = topic_id } } > {{ topic.name }}< / option >
{% endfor %}
< / select >
< / form >
{% endif %}
2024-05-08 00:55:04 -07:00
{% if languages %}
< form method = "get" style = "display:inline;" > Language:
< select name = "language_id" class = "form-control-sm submit_on_change" aria-label = "{{ _('Choose a language to filter communities by') }}" >
< option value = "0" > All< / option >
{% for language in languages %}
< option value = "{{ language.id }}" { { ' selected ' if language . id = = language_id } } > {{ language.name }}< / option >
{% endfor %}
< / select >
< / form >
{% endif %}
2024-02-13 12:29:17 -08:00
< form method = "get" style = "display:inline;" > < input type = "search" name = "search" placeholder = "{{ _('Search') }}" value = "{{ search }}" > < / form >
2023-08-29 03:01:06 -07:00
< / div >
< div class = "col-auto" >
< div class = "btn-group" >
2024-02-26 00:26:19 -08:00
< a href = "{{ url_for('community.add_local') }}" class = "btn btn-outline-secondary" aria-label = "{{ _('Create local community') }}" > {{ _('Create local') }}< / a >
< a href = "{{ url_for('community.add_remote') }}" class = "btn btn-outline-secondary" aria-label = "{{ _('Add community from another instance') }}" > {{ _('Add remote') }}< / a >
2023-08-29 03:01:06 -07:00
< / div >
2024-01-04 17:09:46 -08:00
<!-- <form method="get" action="/communities">
2023-09-05 01:25:02 -07:00
< input name = 'search' type = "search" placeholder = "Find a community" class = "form-control" value = "{{ search }}" / >
2024-01-04 17:09:46 -08:00
< / form > -->
2023-08-29 03:01:06 -07:00
< / div >
< / div >
{% if len(communities) > 0 %}
2024-01-04 17:09:46 -08:00
< div class = "table-responsive-md mt-4" >
2023-11-17 01:02:44 -08:00
< table class = "communities_table table table-striped table-hover w-100" >
2024-01-25 19:19:06 -08:00
< caption class = "visually-hidden" > {{ _('Communities') }}< / caption >
2023-08-29 03:01:06 -07:00
< thead >
< tr >
2024-01-22 22:17:05 -08:00
< th > < / th >
2024-01-25 19:19:06 -08:00
< th { % if not low_bandwidth % } colspan = "2" { % endif % } scope = "col" >
< a href = "?sort_by=title{{ ' desc' if sort_by.text == 'community.title' }}" title = "{{ _('Sort by name') }}" rel = "nofollow" > {{ _('Community') }}
2024-01-06 16:35:36 -08:00
< span class = "{{ 'fe fe-chevron-up' if sort_by.text == 'community.title' }}{{ 'fe fe-chevron-down' if sort_by.text == 'community.title desc' }}" > < / span >
< / a >
< / th >
2024-01-25 19:19:06 -08:00
< th scope = "col" >
< a href = "?sort_by=post_count{{ ' desc' if sort_by.text == 'community.post_count' }}" title = "{{ _('Sort by post count') }}" rel = "nofollow" > {{ _('Posts') }}
2024-01-06 16:35:36 -08:00
< span class = "{{ 'fe fe-chevron-up' if sort_by.text == 'community.post_count' }}{{ 'fe fe-chevron-down' if sort_by.text == 'community.post_count desc' }}" > < / span >
< / a >
< / th >
2024-01-25 19:19:06 -08:00
< th scope = "col" >
< a href = "?sort_by=post_reply_count{{ ' desc' if sort_by.text == 'community.post_reply_count' }}" title = "{{ _('Sort by reply count') }}" rel = "nofollow" > {{ _('Comments') }}
2024-01-06 16:35:36 -08:00
< span class = "{{ 'fe fe-chevron-up' if sort_by.text == 'community.post_reply_count' }}{{ 'fe fe-chevron-down' if sort_by.text == 'community.post_reply_count desc' }}" > < / span >
< / a >
< / th >
2024-01-25 19:19:06 -08:00
< th scope = "col" >
< a href = "?sort_by=last_active{{ ' desc' if sort_by.text == 'community.last_active' }}" title = "{{ _('Sort by recent activity') }}" rel = "nofollow" > {{ _('Active') }}
2024-01-06 16:35:36 -08:00
< span class = "{{ 'fe fe-chevron-up' if sort_by.text == 'community.last_active' }}{{ 'fe fe-chevron-down' if sort_by.text == 'community.last_active desc' }}" > < / span >
< / a >
< / th >
2023-08-29 03:01:06 -07:00
< / tr >
< / thead >
< tbody >
{% for community in communities %}
< tr class = "" >
2024-01-04 17:09:46 -08:00
< td width = "70" > {% if current_user.is_authenticated %}
2024-01-10 23:52:09 -08:00
{% if community_membership(current_user, community) in [SUBSCRIPTION_MEMBER, SUBSCRIPTION_MODERATOR, SUBSCRIPTION_OWNER] %}
2024-02-26 00:26:19 -08:00
< a class = "btn btn-primary btn-sm" href = "/community/{{ community.link() }}/unsubscribe" rel = "nofollow" aria-label = "{{ _('Leave %(name)s', name=community.display_name()) }}" > {{ _('Leave') }}< / a >
2024-01-04 17:09:46 -08:00
{% elif community_membership(current_user, community) == SUBSCRIPTION_PENDING %}
2024-01-15 18:38:56 -08:00
< a class = "btn btn-outline-secondary btn-sm" href = "/community/{{ community.link() }}/unsubscribe" rel = "nofollow" > {{ _('Pending') }}< / a >
2024-01-04 17:09:46 -08:00
{% else %}
2024-02-26 00:26:19 -08:00
< a class = "btn btn-primary btn-sm" href = "/community/{{ community.link() }}/subscribe" rel = "nofollow" aria-label = "{{ _('Join %(name)s', name=community.display_name()) }}" > {{ _('Join') }}< / a >
2024-01-04 17:09:46 -08:00
{% endif %}
{% else %}
2024-02-26 00:26:19 -08:00
< a class = "btn btn-primary btn-sm" href = "/community/{{ community.link() }}/subscribe" rel = "nofollow" aria-label = "{{ _('Join %(name)s', name=community.display_name()) }}" > {{ _('Join') }}< / a >
2024-01-04 17:09:46 -08:00
{% endif %}< / td >
2024-01-07 22:41:32 -08:00
{% if not low_bandwidth %}
< td width = "46" >
2024-02-25 12:50:57 -08:00
< a href = "/c/{{ community.link() }}" > < img src = "{{ community.icon_image('tiny') }}" class = "community_icon rounded-circle" loading = "lazy" alt = "" / > < / a >
2024-01-07 22:41:32 -08:00
< / td >
{% endif %}
2024-02-26 00:26:19 -08:00
< th scope = "row" class = "pl-0" > < a href = "/c/{{ community.link() }}" aria-label = "{{ _('Browse %(name)s', name=community.display_name()) }}" > {{ community.display_name() }}< / a > < / th >
2023-08-29 03:01:06 -07:00
< td > {{ community.post_count }}< / td >
< td > {{ community.post_reply_count }}< / td >
< td > {{ moment(community.last_active).fromNow(refresh=True) }}< / td >
< / tr >
{% endfor %}
< / tbody >
< / table >
< / div >
{% else %}
< p > {{ _('There are no communities yet.') }}< / p >
{% endif %}
2024-03-23 17:44:31 -07:00
< p > < a href = "/topics" class = "btn btn-primary" > {{ _('Browse topics') }}< / a > < / p >
2023-08-22 02:24:11 -07:00
{% endblock %}