misuzu/templates/manage/users/role.twig

102 lines
4.6 KiB
Twig
Raw Normal View History

2022-09-13 13:14:49 +00:00
{% extends 'manage/users/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from 'manage/macros.twig' import permissions_table %}
{% from '_layout/input.twig' import input_csrf, input_text, input_checkbox %}
{% block manage_content %}
2023-07-27 23:26:05 +00:00
<form action="{{ url('manage-role', {'role': role_info.id|default(0)}) }}" method="post"{% if role_info is not null %} style="--accent-colour: {{ role_info.colour }}"{% endif %}>
2022-09-13 13:14:49 +00:00
{{ input_csrf() }}
<div class="container">
{{ container_title(role_info is not null ? 'Editing ' ~ role_info.name ~ ' (' ~ role_info.id ~ ')' : 'Creating a new role') }}
<label class="form__label">
<div class="form__label__text">Role Name</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_text('ur_name', '', role_ur_name|default(role_info.name|default()), 'text', '', true, {'maxlength':255}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
2023-07-27 23:26:05 +00:00
<div class="form__label__text">Hide Role</div>
2022-09-13 13:14:49 +00:00
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_checkbox('ur_hidden', '', role_ur_hidden is defined ? role_ur_hidden : (role_info is not null ? role_info.hidden : false)) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
2023-07-27 23:26:05 +00:00
<div class="form__label__text">Role can be removed by the user themselves</div>
2022-09-13 13:14:49 +00:00
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_checkbox('ur_leavable', '', role_ur_leavable is defined ? role_ur_leavable : (role_info is not null ? role_info.leavable : false)) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Rank</div>
<div class="form__label__input">
{{ input_text('ur_rank', '', role_ur_rank|default(role_info.rank|default(1)), 'number', '', true) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Title</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_text('ur_title', '', role_ur_title|default(role_info.title|default()), 'text', '', false, {'maxlength':64}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
</div>
<div class="container">
{{ container_title('Colour') }}
<label class="form__label">
<div class="form__label__text">Inherit Colour</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_checkbox('ur_col_inherit', '', role_ur_col_inherit is defined ? role_ur_col_inherit : (role_info is not null and role_info.hasColour ? role_info.colour.shouldInherit : true)) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Red</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_text('ur_col_red', '', role_ur_col_red|default(role_info.colour.red|default(0)), 'number', '', false, {'min':0,'max':255}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Green</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_text('ur_col_green', '', role_ur_col_green|default(role_info.colour.green|default(0)), 'number', '', false, {'min':0,'max':255}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Blue</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
{{ input_text('ur_col_blue', '', role_ur_col_blue|default(role_info.colour.blue|default(0)), 'number', '', false, {'min':0,'max':255}) }}
2022-09-13 13:14:49 +00:00
</div>
</label>
</div>
<div class="container">
{{ container_title('Additional') }}
<label class="form__label">
<div class="form__label__text">Description</div>
<div class="form__label__input">
2023-07-27 23:26:05 +00:00
<textarea class="input__textarea" name="ur_desc" maxlength="1000">{{ role_ur_desc|default(role_info.description|default()) }}</textarea>
2022-09-13 13:14:49 +00:00
</div>
</label>
</div>
<div class="container">
{{ container_title('Permissions') }}
2023-08-30 22:37:21 +00:00
{{ permissions_table(perms_lists, perms_infos, not can_edit_perms) }}
2022-09-13 13:14:49 +00:00
</div>
<button class="input__button">{{ role_info is not null ? 'Update role' : 'Create role' }}</button>
</form>
{% endblock %}