nopaque/app/templates/admin/user_settings.html.j2

67 lines
2.3 KiB
Plaintext
Raw Normal View History

2023-04-04 07:01:51 +00:00
{% extends "users/settings/settings.html.j2" %}
2023-03-27 08:22:43 +00:00
2023-03-29 12:32:35 +00:00
{% block admin_settings %}
<div class="col s12"></div>
2023-03-29 12:32:35 +00:00
<div class="col s12 l4">
<h4>Administrator Settings</h4>
<p>Here the Confirmation Status of the user can be set manually and a special role can be assigned.</p>
2023-03-29 12:32:35 +00:00
</div>
<div class="col s12 l8">
<br>
<ul class="collapsible no-autoinit settings-collapsible">
<li>
<div class="collapsible-header" style="justify-content: space-between;">
<span>Confirmation status</span>
<i class="caret material-icons">keyboard_arrow_right</i>
</div>
<div class="collapsible-body">
2023-04-11 13:03:12 +00:00
<div style="overflow: auto;">
<p class="left"><i class="material-icons">check</i></p>
<p class="left" style="margin-left: 10px;">
Confirmed<br>
<span class="light">Change confirmation status manually.</span>
</p>
<br class="hide-on-med-and-down">
<div class="switch right">
<label>
<input {% if user.confirmed %}checked{% endif %} id="user-confirmed-switch" type="checkbox">
<span class="lever"></span>
</label>
2023-03-29 12:32:35 +00:00
</div>
</div>
</div>
</li>
<li>
<div class="collapsible-header" style="justify-content: space-between;">
<span>Role</span>
<i class="caret material-icons">keyboard_arrow_right</i>
</div>
<div class="collapsible-body">
<form method="POST">
{{ update_user_form.hidden_tag() }}
{{ wtf.render_field(update_user_form.role, material_icon='manage_accounts') }}
<div class="right-align">
{{ wtf.render_field(update_user_form.submit, material_icon='send') }}
</div>
</form>
</div>
</li>
</ul>
</div>
{% endblock admin_settings %}
{% block scripts %}
2023-03-27 08:22:43 +00:00
{{ super() }}
2023-03-29 12:32:35 +00:00
<script>
let userConfirmedSwitchElement = document.querySelector('#user-confirmed-switch');
userConfirmedSwitchElement.addEventListener('change', (event) => {
let newConfirmed = userConfirmedSwitchElement.checked;
2023-10-04 12:07:39 +00:00
requests.admin.users.entity.confirmed.update({{ user.hashid|tojson }}, newConfirmed)
2023-03-29 12:32:35 +00:00
.catch((response) => {
userConfirmedSwitchElement.checked = !userConfirmedSwitchElement;
});
});
</script>
{% endblock scripts %}