Browse Source

Actually use jinja2 formatting for if

master
Drew Short 5 years ago
parent
commit
f1bf954ed9
  1. 86
      templates/admin.html

86
templates/admin.html

@ -8,40 +8,40 @@
<div id="activeRegistrationCodes">
<table>
<thead>
<th>Registration Code</th>
<th>Creation Time</th>
<th>Expiration Time</th>
<th>Usages</th>
<th>Max Usages</th>
<th>Registration Link</th>
<th>Expire</th>
<th>Registration Code</th>
<th>Creation Time</th>
<th>Expiration Time</th>
<th>Usages</th>
<th>Max Usages</th>
<th>Registration Link</th>
<th>Expire</th>
</thead>
<tbody>
{% for registration_code in registration_codes %}
<tr>
<td>{{ registration_code.code|tojson|safe }}</td>
<td>{{ registration_code.creation_time|tojson|safe }}</td>
<td>{{ registration_code.expiration_time|tojson|safe }}</td>
<td>{{ registration_code.usages|tojson|safe }}</td>
<td>{{ registration_code.max_usages|tojson|safe }}</td>
<td>
{% if not registration_code.is_expired() and registration_code.has_available_uses() %}
{% for registration_code in registration_codes %}
<tr>
<td>{{ registration_code.code|tojson|safe }}</td>
<td>{{ registration_code.creation_time|tojson|safe }}</td>
<td>{{ registration_code.expiration_time|tojson|safe }}</td>
<td>{{ registration_code.usages|tojson|safe }}</td>
<td>{{ registration_code.max_usages|tojson|safe }}</td>
<td>
{% if not registration_code.is_expired() and registration_code.has_available_uses() %}
<a href="/register?registrationCode={{ registration_code.code }}">link</a>
{% endif %}
<td class="borderless">
<form method="POST" action="/admin/expire_registration_code">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="registration_code" value="{{ registration_code.code }}"/>
{% if not registration_code.is_expired() %}
{% endif %}
<td class="borderless">
<form method="POST" action="/admin/expire_registration_code">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="registration_code" value="{{ registration_code.code }}"/>
{% if not registration_code.is_expired() %}
<input type="submit" name="expire" value="Expire">
{% else %}
<input type="submit" name="delete"
value="Delete" {% disabled="true" if registration_code.usages > 0 %}>
{% endif %}
</form>
</td>
</tr>
{% endfor %}
{% else %}
<input type="submit" name="delete"
value="Delete" {% if registration_code.usages > 0 %} disabled="true" {% endif %}>
{% endif %}
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
@ -50,19 +50,19 @@
<table>
<thead>
<th>Matrix ID</th>
<th>User</th>
<th>Registration Time</th>
<th>Registration Code</th>
<th>User</th>
<th>Registration Time</th>
<th>Registration Code</th>
</thead>
<tbody>
{% for registered_user in registered_users %}
<tr>
<td>{{ registered_user.registered_user_id|tojson|safe }}</td>
<td>{{ registered_user.username|tojson|safe }}</td>
<td>{{ registered_user.registered_time|tojson|safe }}</td>
<td>{{ registered_user.registration_code|tojson|safe }}</td>
</tr>
{% endfor %}
{% for registered_user in registered_users %}
<tr>
<td>{{ registered_user.registered_user_id|tojson|safe }}</td>
<td>{{ registered_user.username|tojson|safe }}</td>
<td>{{ registered_user.registered_time|tojson|safe }}</td>
<td>{{ registered_user.registration_code|tojson|safe }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
@ -71,10 +71,10 @@
<form method="POST" action="/admin/add_registration_code">
{{ add_registration_code_form.csrf_token }}
<div class="row">
{{ add_registration_code_form.expiration_time.label }} {{ add_registration_code_form.expiration_time() }}
{{ add_registration_code_form.expiration_time.label }} {{ add_registration_code_form.expiration_time() }}
</div>
<div class="row">
{{ add_registration_code_form.max_usages.label }} {{ add_registration_code_form.max_usages(default="1", value="1") }}
{{ add_registration_code_form.max_usages.label }} {{ add_registration_code_form.max_usages(default="1", value="1") }}
</div>
<div class="formSubmit">
<input type="submit" value="Add Token">

Loading…
Cancel
Save