improve mobile navigation in communities

This commit is contained in:
rimu 2025-01-01 12:01:51 +13:00
parent dcb340f9cf
commit 6573d25dd3
3 changed files with 28 additions and 5 deletions

View file

@ -20,14 +20,14 @@
{% endif -%} {% endif -%}
</div> </div>
<form method="get" action="/search"> <form method="get" action="/search">
<input type="search" name="q" class="form-control mt-2" placeholder="{{ _('Search this community') }}" /> <input type="search" id="search_community" name="q" class="form-control mt-2" placeholder="{{ _('Search this community') }}" />
<input type="hidden" name="community" value="{{ community.id }}"> <input type="hidden" name="community" value="{{ community.id }}">
</form> </form>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block about_community %} {% block about_community %}
<div class="card mt-3"> <div class="card mt-3" id="about_community">
<div class="card-header"> <div class="card-header">
<h2>{{ community.title }}</h2> <h2>{{ community.title }}</h2>
</div> </div>

View file

@ -1,8 +1,31 @@
{% if community %} {% 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]) %} {% 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="mobile_create_post d-md-none mt-1">
<div class="dropdown">
<a class="btn btn-primary" href="/community/{{ community.link() }}/submit">{{ _('Create post') }}</a> <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> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -47,7 +47,7 @@
<td> <td>
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Actions {{ _('Actions') }}
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% if user.is_local() %}<li><a class="dropdown-item" href="/chat/{{ user.id }}/new">Send Message</a></li>{% endif %} {% if user.is_local() %}<li><a class="dropdown-item" href="/chat/{{ user.id }}/new">Send Message</a></li>{% endif %}