2024-05-30 02:54:25 -07:00
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') -%}
{% extends 'themes/' + theme() + '/base.html' -%}
{% else -%}
{% extends "base.html" -%}
{% endif -%} -%}
{% from 'bootstrap5/form.html' import render_form -%}
{% set active_child = 'list_communities' -%}
2023-08-22 02:24:11 -07:00
2024-05-30 02:54:25 -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-12-07 09:06:00 -08:00
{% if current_user.is_authenticated -%}
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-12-05 10:34:24 -08:00
< a href = "/communities/notsubscribed" aria-label = "{{ _('Not Joined communities') }}" class = "btn {{ 'btn-primary' if request.path == '/communities/notsubscribed' else 'btn-outline-secondary' }}" >
{{ _('Not Joined') }}
< / a >
2024-12-07 09:06:00 -08:00
{% endif -%}
2024-02-13 12:29:17 -08:00
< / div >
< / div >
< div class = "col-auto" >
2024-12-17 03:15:36 -08:00
< form action = "/communities"
method="get"
hx-boost="true"
hx-trigger="change[event.target.matches('select[name=topic_id] select[name=language_id]')]">
{% if topics -%}
< div style = "display:inline;" >
Topic:
< select name = "topic_id"
class="form-control-sm"
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 >
< / div >
{% endif -%}
{% if languages -%}
< div style = "display:inline;" >
Language:
< select name = "language_id"
class="form-control-sm"
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 >
< / div >
{% endif -%}
< div style = "display:inline;" >
< input type = "search"
name="search"
placeholder="{{ _('Search') }}"
value="{{ search }}">
< / div >
< / 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 >
2024-05-30 02:54:25 -07:00
{% if communities -%}
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-05-30 02:54:25 -07:00
< th { % if not low_bandwidth - % } colspan = "2" { % endif - % } scope = "col" >
2024-12-17 04:58:37 -08:00
< button
hx-get="/communities"
hx-vals='{"sort_by": "title{{ ' asc' if sort_by == 'title desc' else ' desc' }}"}'
hx-include="form[action='/communities']"
hx-target="body"
hx-push-url="true"
title="{{ _('Sort by name') }}"
class="btn"
>
{{ _('Community') }}
2024-06-29 12:04:28 -07:00
< span class = "{{ 'fe fe-chevron-up' if sort_by == 'title asc' }}{{ 'fe fe-chevron-down' if sort_by == 'title desc' }}" > < / span >
2024-12-17 04:58:37 -08:00
< / button >
2024-01-06 16:35:36 -08:00
< / th >
2024-01-25 19:19:06 -08:00
< th scope = "col" >
2024-12-17 05:03:13 -08:00
< button
hx-get="/communities"
hx-vals='{"sort_by": "post_count{{ ' asc' if sort_by == 'post_count desc' else ' desc' }}"}'
hx-include="form[action='/communities']"
hx-target="body"
hx-push-url="true"
2024-12-17 05:13:52 -08:00
title="{{ _('Sort by post count') }}"
2024-12-17 05:03:13 -08:00
class="btn"
>
{{ _('Posts') }}
2024-06-29 12:04:28 -07:00
< span class = "{{ 'fe fe-chevron-up' if sort_by == 'post_count asc' }}{{ 'fe fe-chevron-down' if sort_by == 'post_count desc' }}" > < / span >
2024-12-17 05:03:13 -08:00
< / button >
2024-01-06 16:35:36 -08:00
< / th >
2024-01-25 19:19:06 -08:00
< th scope = "col" >
2024-12-17 05:06:52 -08:00
< button
hx-get="/communities"
hx-vals='{"sort_by": "post_reply_count{{ ' asc' if sort_by == 'post_reply_count desc' else ' desc' }}"}'
hx-include="form[action='/communities']"
hx-target="body"
hx-push-url="true"
title="{{ _('Comments') }}"
class="btn"
>
{{ _('Comments') }}
< span class = "{{ 'fe fe-chevron-up' if sort_by == 'post_reply_count asc' }}{{ 'fe fe-chevron-down' if sort_by == 'post_reply_count desc' }}" > < / span >
< / button >
2024-01-06 16:35:36 -08:00
< / th >
2024-01-25 19:19:06 -08:00
< th scope = "col" >
2024-12-17 05:11:33 -08:00
< button
hx-get="/communities"
hx-vals='{"sort_by": "last_active{{ ' asc' if sort_by == 'last_active desc' else ' desc' }}"}'
hx-include="form[action='/communities']"
hx-target="body"
hx-push-url="true"
title="{{ _('Sort by recent activity') }}"
class="btn"
>
{{ _('Active') }}
2024-06-29 12:04:28 -07:00
< span class = "{{ 'fe fe-chevron-up' if sort_by == 'last_active asc' }}{{ 'fe fe-chevron-down' if sort_by == 'last_active desc' }}" > < / span >
2024-12-17 05:11:33 -08:00
< / button >
2024-01-06 16:35:36 -08:00
< / th >
2023-08-29 03:01:06 -07:00
< / tr >
< / thead >
< tbody >
2024-05-30 02:54:25 -07:00
{% for community in communities.items -%}
2024-06-28 13:41:42 -07:00
{% set content_blocked = (current_user.hide_nsfw == 3 and community.nsfw)
or (current_user.hide_nsfl == 3 and community.nsfl) -%}
{% set blur_content = (current_user.hide_nsfw == 2 and community.nsfw)
or (current_user.hide_nsfl == 2 and community.nsfl) -%}
< tr class = "{{ 'blocked' if content_blocked }}{{ 'blur' if blur_content }}" >
2024-05-30 02:54:25 -07:00
< td width = "70" > {% if current_user.is_authenticated -%}
{% 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-05-30 02:54:25 -07: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-05-30 02:54:25 -07: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-05-30 02:54:25 -07: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-05-30 02:54:25 -07:00
{% endif -%}< / td >
{% if not low_bandwidth -%}
2024-01-07 22:41:32 -08:00
< 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 >
2024-05-30 02:54:25 -07:00
{% 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 >
2024-08-22 16:14:47 -07:00
< td > {{ arrow.get(community.last_active).humanize(locale=locale) }}< / td >
2023-08-29 03:01:06 -07:00
< / tr >
2024-05-30 02:54:25 -07:00
{% endfor -%}
2023-08-29 03:01:06 -07:00
< / tbody >
< / table >
< / div >
2024-05-10 19:02:18 -07:00
< nav aria-label = "Pagination" class = "mt-4" role = "navigation" >
2024-05-30 02:54:25 -07:00
{% if prev_url -%}
2024-05-10 19:02:18 -07:00
< a href = "{{ prev_url }}" class = "btn btn-primary" rel = 'nofollow' >
< span aria-hidden = "true" > ← < / span > {{ _('Previous page') }}
< / a >
2024-05-30 02:54:25 -07:00
{% endif -%}
{% if next_url -%}
2024-05-10 19:02:18 -07:00
< a href = "{{ next_url }}" class = "btn btn-primary" rel = 'nofollow' >
{{ _('Next page') }} < span aria-hidden = "true" > → < / span >
< / a >
2024-05-30 02:54:25 -07:00
{% endif -%}
2024-05-10 19:02:18 -07:00
< / nav >
2024-05-30 02:54:25 -07:00
{% else -%}
2023-08-29 03:01:06 -07:00
< p > {{ _('There are no communities yet.') }}< / p >
2024-05-30 02:54:25 -07:00
{% endif -%}
2024-05-10 19:02:18 -07:00
< p class = "mt-4" > < a href = "/topics" class = "btn btn-primary" > {{ _('Browse topics') }}< / a > < / p >
2024-05-30 02:54:25 -07:00
{% endblock -%}