misuzu/templates/manage/users/role.twig

95 lines
4 KiB
Twig
Raw Normal View History

2018-08-15 01:12:58 +00:00
{% extends 'manage/users/master.twig' %}
2018-10-22 19:53:21 +00:00
{% from 'macros.twig' import container_title %}
2018-08-15 01:12:58 +00:00
{% from 'manage/macros.twig' import permissions_table %}
2018-10-27 14:29:13 +00:00
{% from '_layout/input.twig' import input_csrf, input_text, input_checkbox %}
2018-03-31 22:28:32 +00:00
{% block manage_content %}
2020-06-04 18:48:01 +00:00
<form action="?v=role{{ role_info is not null ? '&r=' ~ role_info.id : '' }}" method="post"{% if role_info is not null %} style="--accent-colour: {{ role_info.colour }}"{% endif %}>
2019-06-10 15:21:53 +00:00
{{ input_csrf() }}
2018-10-02 19:16:42 +00:00
2018-03-31 22:28:32 +00:00
<div class="container">
2020-06-04 18:48:01 +00:00
{{ container_title(role_info is not null ? 'Editing ' ~ role_info.name ~ ' (' ~ role_info.id ~ ')' : 'Creating a new role') }}
2018-03-31 22:28:32 +00:00
<label class="form__label">
<div class="form__label__text">Role Name</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_text('role[name]', '', role_info.name|default(''), 'text', '', true, {'maxlength':255}) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Hide Rank</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_checkbox('role[secret]', '', role_info is not null and role_info.hidden) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Hierarchy</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_text('role[hierarchy]', '', role_info.rank|default(1), 'number', '', true) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
2018-07-08 19:24:59 +00:00
<label class="form__label">
<div class="form__label__text">Title</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_text('role[title]', '', role_info.title|default(''), 'text', '', false, {'maxlength':64}) }}
2018-07-08 19:24:59 +00:00
</div>
</label>
</div>
<div class="container">
2018-10-22 19:53:21 +00:00
{{ container_title('Colour') }}
2018-03-31 22:28:32 +00:00
<label class="form__label">
<div class="form__label__text">Inherit Colour</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_checkbox('role[colour][inherit]', '', role_info is not null ? role_info.colour.inherit : true) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Red</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_text('role[colour][red]', '', role_info.colour.red|default(0), 'number', '', false, {'min':0,'max':255}) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Green</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_text('role[colour][green]', '', role_info.colour.green|default(0), 'number', '', false, {'min':0,'max':255}) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
<label class="form__label">
<div class="form__label__text">Blue</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
{{ input_text('role[colour][blue]', '', role_info.colour.blue|default(0), 'number', '', false, {'min':0,'max':255}) }}
2018-03-31 22:28:32 +00:00
</div>
</label>
</div>
<div class="container">
2018-10-22 19:53:21 +00:00
{{ container_title('Additional') }}
2018-03-31 22:28:32 +00:00
<label class="form__label">
<div class="form__label__text">Description</div>
<div class="form__label__input">
2020-06-04 18:48:01 +00:00
<textarea class="input__textarea" name="role[description]" maxlength="1000">{{ role_info.description|default('') }}</textarea>
2018-03-31 22:28:32 +00:00
</div>
</label>
2018-07-08 19:24:59 +00:00
</div>
2018-03-31 22:28:32 +00:00
2019-06-09 22:10:59 +00:00
<div class="container">
{{ container_title('Permissions') }}
{{ permissions_table(permissions, not can_manage_perms) }}
</div>
2018-07-08 19:24:59 +00:00
2020-06-04 18:48:01 +00:00
<button class="input__button">{{ role_info is not null ? 'Update role' : 'Create role' }}</button>
2018-03-31 22:28:32 +00:00
</form>
{% endblock %}