forked from MarseyWorld/MarseyWorld
88 lines
3.5 KiB
HTML
88 lines
3.5 KiB
HTML
{% extends "default.html" %}
|
|
{% block pagetitle %}!{{group}}{% endblock %}
|
|
{% block content %}
|
|
|
|
{% if v.id != group.owner.id %}
|
|
<button id="leave-{{group}}" type="button" class="mt-4 btn btn-primary btn-block {% if v.id not in group.membership_user_ids %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/leave','leave-{{group}}','apply-{{group}}','d-none')">
|
|
{%- if v.id in group.member_ids -%}
|
|
Leave
|
|
{%- else -%}
|
|
Cancel Application
|
|
{%- endif -%}
|
|
</button>
|
|
|
|
<button id="apply-{{group}}" type="button" class="mt-4 {% if v.id in group.membership_user_ids %}d-none{% endif %} btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/apply','leave-{{group}}','apply-{{group}}','d-none')">Apply to Join</button>
|
|
{% endif %}
|
|
|
|
<br>
|
|
{% macro process_memberships(memberships, name) %}
|
|
<h5 class="my-3">!{{group}} {{name}}</h5>
|
|
|
|
<div class="overflow-x-auto mt-1">
|
|
<table class="table table-striped mb-5 ping-groups">
|
|
<thead class="bg-primary text-white">
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Name</th>
|
|
|
|
{% if name == 'members' %}
|
|
<th>Approved on</th>
|
|
{% else %}
|
|
<th>Applied on</th>
|
|
{% endif %}
|
|
|
|
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
|
|
<th class="disable-sort-click"></th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody id="{{name}}_tbody">
|
|
{% for membership in memberships %}
|
|
<tr id="{{membership.user_id}}">
|
|
<td id="counter-{{membership.user_id}}">{{loop.index}}</td>
|
|
{% set owner = name == 'members' and loop.index == 1 %}
|
|
<td {% if owner %}class="unbreakable"{% endif %}>
|
|
{% with user=membership.user %}
|
|
{% include "user_in_table.html" %}
|
|
{% endwith %}
|
|
{% if owner %}
|
|
<img class="mx-2 group-owner" data-bs-toggle="tooltip" alt="Owner" title="Owner" src="/e/marseykingretard.webp">
|
|
{% endif %}
|
|
</td>
|
|
|
|
{% if name == 'members' %}
|
|
<td id="time-{{membership.user_id}}" data-time="{{membership.approved_utc}}"></td>
|
|
{% else %}
|
|
<td id="time-{{membership.user_id}}" data-time="{{membership.created_utc}}"></td>
|
|
{% endif %}
|
|
|
|
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
|
|
<td>
|
|
<div id="kick-{{membership.user_id}}" {% if name == 'applications' %}class="d-none"{% endif %}>
|
|
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="reject_membership(this,'{{group}}','{{membership.user_id}}')">{% if v.id == membership.user_id %}Leave{% else %}Kick{% endif %}</button>
|
|
</div>
|
|
|
|
<div {% if name == 'members' %}class="d-none"{% endif %}>
|
|
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="approve_membership(this,'{{group}}','{{membership.user_id}}')">Approve</button>
|
|
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="reject_membership(this,'{{group}}','{{membership.user_id}}')">Reject</button>
|
|
</div>
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
|
|
{{process_memberships(applications, 'applications')}}
|
|
{{process_memberships(members, 'members')}}
|
|
<script defer src="{{'js/group_members_owner.js' | asset}}"></script>
|
|
{% else %}
|
|
{{process_memberships(members, 'members')}}
|
|
{{process_memberships(applications, 'applications')}}
|
|
{% endif %}
|
|
|
|
{% endblock %}
|