init
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
{% extends "affiliations/base.html" %}
|
||||
{% set active_page = "users" %}
|
||||
|
||||
{% block page %}
|
||||
{% if affiliations %}
|
||||
<form method="GET" action="{{ url_for('ctfd-affiliations.admin_users') }}" class="mb-4">
|
||||
<label for="affiliation-select"><b>Affiliation</b></label>
|
||||
<select id="affiliation-select" name="affiliation" class="form-control custom-select" onchange="this.form.submit()">
|
||||
<option value="" disabled {% if selected is none %}selected{% endif %}>Select affiliation</option>
|
||||
{% for affiliation, count in affiliations.items() %}
|
||||
<option value="{{ affiliation }}" {% if affiliation == selected %}selected{% endif %}>
|
||||
{{ affiliation }} ({{ count }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="text-muted">
|
||||
No affiliations yet. Create a code on the
|
||||
<a href="{{ url_for('ctfd-affiliations.admin_codes') }}">Codes</a> page.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if selected is not none %}
|
||||
<form method="POST" action="{{ url_for('ctfd-affiliations.admin_add_user') }}" class="form-row align-items-end mb-3">
|
||||
<input type="hidden" name="nonce" value="{{ Session.nonce }}">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="add-user-id"><b>User ID</b></label>
|
||||
<input id="add-user-id" name="user_id" type="number" min="1" class="form-control" required>
|
||||
</div>
|
||||
{% if codes | length > 1 %}
|
||||
<div class="form-group col-md-4">
|
||||
<label for="add-code"><b>Code</b></label>
|
||||
<select id="add-code" name="code_id" class="form-control custom-select">
|
||||
{% for code in codes %}
|
||||
<option value="{{ code.id }}">{{ code.code }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% else %}
|
||||
<input type="hidden" name="code_id" value="{{ codes[0].id }}">
|
||||
{% endif %}
|
||||
<div class="form-group col-md-2">
|
||||
<button type="submit" class="btn btn-primary w-100">Add</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if members %}
|
||||
<table class="table table-striped border">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">ID</th>
|
||||
<th>User</th>
|
||||
<th>Email</th>
|
||||
<th>Code</th>
|
||||
<th>Added</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for member in members %}
|
||||
<tr>
|
||||
<td class="text-center">{{ member.user.id }}</td>
|
||||
<td><a href="{{ url_for('admin.users_detail', user_id=member.user.id) }}">{{ member.user.name }}</a></td>
|
||||
<td>{{ member.user.email }}</td>
|
||||
<td class="text-monospace">{{ member.code.code }}</td>
|
||||
<td>{{ member.created.strftime('%Y-%m-%d %H:%M') if member.created else '' }} UTC</td>
|
||||
<td class="text-right">
|
||||
<form method="POST" action="{{ url_for('ctfd-affiliations.admin_remove_user', user_id=member.user_id) }}" class="d-inline"
|
||||
onsubmit="return confirm('Remove {{ member.user.name }} from {{ selected }}? Their affiliation will be cleared.');">
|
||||
<input type="hidden" name="nonce" value="{{ Session.nonce }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger" title="Remove">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="text-muted">No users in this affiliation yet.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user