misuzu/templates/manage/news/post.twig

39 lines
1.5 KiB
Twig
Raw Normal View History

2022-09-13 13:14:49 +00:00
{% 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">
2023-07-15 17:02:46 +00:00
{{ container_title(post_new ? 'New Post' : 'Editing ' ~ post_info.title) }}
2022-09-13 13:14:49 +00:00
{{ input_csrf() }}
<table style="color:inherit">
<tr>
<td>Name</td>
2023-07-15 17:02:46 +00:00
<td>{{ input_text('np_title', '', post_info.title|default(), 'text', '', true) }}</td>
2022-09-13 13:14:49 +00:00
</tr>
<tr>
<td>Category</td>
2023-07-15 17:02:46 +00:00
<td>{{ input_select('np_category', categories, post_info.categoryId|default(0)) }}</td>
2022-09-13 13:14:49 +00:00
</tr>
<tr>
<td>Is Featured</td>
<td>{{ input_checkbox('np_featured', '', post_info.featured|default(false)) }}</td>
2022-09-13 13:14:49 +00:00
</tr>
<tr>
2023-07-15 17:02:46 +00:00
<td colspan="2"><textarea name="np_body" required class="input__textarea">{{ post_info.body|default() }}</textarea></td>
2022-09-13 13:14:49 +00:00
</tr>
</table>
2023-07-15 17:02:46 +00:00
<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>
2023-07-15 17:02:46 +00:00
{% endif %}
</div>
2022-09-13 13:14:49 +00:00
</form>
{% endblock %}