pyfedi/app/templates/community/_community_nav.html

58 lines
4 KiB
HTML

{% if community %}
{% if not community.restricted_to_mods or (community.restricted_to_mods and current_user.is_authenticated and community_membership(current_user, community) in [SUBSCRIPTION_MODERATOR, SUBSCRIPTION_OWNER]) %}
<div class="mobile_create_post d-md-none mt-1">
<div class="dropdown">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ _('Actions') }}
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/community/{{ community.link() }}/submit">{{ _('Create post') }}</a></li>
<li><a class="dropdown-item" href="#search_community">{{ _('Search') }}</a></li>
<li><a class="dropdown-item" href="#about_community">{{ _('About community') }}</a></li>
<div class="dropdown-divider"></div>
{% if current_user.is_authenticated and community_membership(current_user, community) in [SUBSCRIPTION_MEMBER, SUBSCRIPTION_MODERATOR, SUBSCRIPTION_OWNER] -%}
<li><a class="dropdown-item" href="/community/{{ community.link() }}/unsubscribe" rel="nofollow">{{ _('Leave') }}</a></li>
{% elif current_user.is_authenticated and community_membership(current_user, community) == SUBSCRIPTION_PENDING -%}
<li><a class="dropdown-item" href="/community/{{ community.link() }}/unsubscribe" rel="nofollow">{{ _('Pending') }}</a></li>
{% else -%}
<li><a class="dropdown-item" href="/community/{{ community.link() }}/subscribe" rel="nofollow">{{ _('Join') }}</a></li>
{% endif -%}
{% if is_moderator or is_owner or is_admin -%}
<div class="dropdown-divider"></div>
<li><a class="dropdown-item" href="/community/{{ community.link() }}/moderate">{{ _('Moderate') }}</a></li>
{% endif -%}
{% if is_owner or is_admin -%}
<li><a class="dropdown-item" href="{{ url_for('community.community_edit', community_id=community.id) }}">{{ _('Settings') }}</a></li>
{% endif -%}
</ul>
</div>
</div>
{% endif %}
{% endif %}
<div class="btn-group mt-1 mb-2">
<a href="?sort=hot&layout={{ post_layout }}" aria-label="{{ _('Sort by hot') }}" class="btn {{ 'btn-primary' if sort == '' or sort == 'hot' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('Hot') }}
</a>
<a href="?sort=top&layout={{ post_layout }}" aria-label="{{ _('Sort by top') }}" class="btn {{ 'btn-primary' if sort == 'top' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('Top') }}
</a>
<a href="?sort=new&layout={{ post_layout }}" aria-label="{{ _('Sort by new') }}" class="btn {{ 'btn-primary' if sort == 'new' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('New') }}
</a>
<a href="?sort=active&layout={{ post_layout }}" aria-label="{{ _('Sort by active') }}" class="btn {{ 'btn-primary' if sort == 'active' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('Active') }}
</a>
</div>
{% if post_layout != '' and post_layout is not none %}
<div class="btn-group mt-1 mb-2 layout_switcher">
<a href="?layout=list&sort={{ sort }}" class="btn {{ 'btn-primary' if post_layout == '' or post_layout == 'list' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('List') }}
</a>
<a href="?layout=masonry&sort={{ sort }}" class="btn {{ 'btn-primary' if post_layout == 'masonry' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('Tile') }}
</a>
<a href="?layout=masonry_wide&sort={{ sort }}" class="btn {{ 'btn-primary' if post_layout == 'masonry_wide' else 'btn-outline-secondary' }}" rel="nofollow noindex">
{{ _('Wide tile') }}
</a>
</div>
{% endif %}