misuzu/templates/manage/changelog/change.twig

64 lines
2.9 KiB
Twig

{% extends 'manage/changelog/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from '_layout/input.twig' import input_csrf, input_text, input_select, input_checkbox %}
{% if not change_new %}
{% set site_link = url('changelog-change', {'change': change_info.id}) %}
{% endif %}
{% block manage_content %}
<div class="container">
<form action="{{ url('manage-changelog-change', {'change': change_info.id|default(0)}) }}" method="post">
{{ input_csrf() }}
{{ container_title(change_new ? 'Adding a new change' : 'Editing #' ~ change_info.id) }}
<div style="display: flex; margin: 2px 5px;">
{{ input_select('cl_action', change_actions, change_info.action|default('add')) }}
{{ input_text('cl_summary', '', change_info.summary|default(''), 'text', '', true, {'maxlength': 255, 'style': 'flex-grow: 1'}) }}
</div>
<label class="form__label">
<div class="form__label__text">Text</div>
<div class="form__label__input">
<textarea class="input__textarea" name="cl_body" maxlength="65535">{{ change_info.body|default('') }}</textarea>
</div>
</label>
<label class="form__label">
<div class="form__label__text">Contributor Id</div>
<div class="form__label__input">
{{ input_text('cl_user', '', change_info.userId|default(change_author_id), 'number', '', false, {'min':1}) }}
</div>
</label>
<label class="form__label">
<div class="form__label__text">Created</div>
<div class="form__label__input">
{{ input_text('cl_created', '', change_info.createdTime|default(-1)|date('Y-m-d\\TH:i'), 'datetime-local', '', true) }}
</div>
</label>
<div class="manage__tags">
{% for tag in change_tags %}
<label class="manage__tag">
<div class="manage__tag__background"></div>
<div class="manage__tag__content">
{{ input_checkbox('cl_tags[]', '', tag.id in change_info_tags, 'manage__tag__checkbox', tag.id) }}
<div class="manage__tag__title">
{{ tag.name }}
</div>
</div>
</label>
{% endfor %}
</div>
<div>
<button class="input__button">Save</button>
{% if not change_new %}
<a href="{{ url('manage-changelog-change-delete', { change: change_info.id, csrf: csrf_token() }) }}" class="input__button input__button--destroy" onclick="return confirm('Are you sure?');">Delete</a>
{% endif %}
</div>
</form>
</div>
{% endblock %}