misuzu/templates/manage/news/post.twig

38 lines
1.5 KiB
Twig

{% extends 'manage/news/master.twig' %}
{% from 'macros.twig' import container_title %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text, input_checkbox, input_select %}
{% block manage_content %}
<form method="post" action="{{ url('manage-news-post', {'post': post_info.id|default(0)}) }}" class="container">
{{ container_title(post_new ? 'New Post' : 'Editing ' ~ post_info.title) }}
{{ input_csrf() }}
<table style="color:inherit">
<tr>
<td>Name</td>
<td>{{ input_text('np_title', '', post_info.title|default(), 'text', '', true) }}</td>
</tr>
<tr>
<td>Category</td>
<td>{{ input_select('np_category', categories, post_info.categoryId|default(0)) }}</td>
</tr>
<tr>
<td>Is Featured</td>
<td>{{ input_checkbox('np_featured', '', post_info.featured|default(false)) }}</td>
</tr>
<tr>
<td colspan="2"><textarea name="np_body" required class="input__textarea">{{ post_info.body|default() }}</textarea></td>
</tr>
</table>
<div>
<button class="input__button">Save</button>
{% if not post_new %}
<a href="{{ url('manage-news-post-delete', { post: post_info.id, csrf: csrf_token() }) }}" class="input__button input__button--destroy" onclick="return confirm('Are you sure?');">Delete</a>
{% endif %}
</div>
</form>
{% endblock %}