misuzu/templates/manage/general/quotes.twig

74 lines
3.1 KiB
Twig

{% extends 'manage/general/master.twig' %}
{% from 'home/macros.twig' import chat_quote_display %}
{% from 'macros.twig' import pagination, container_title %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text %}
{% block manage_content %}
<div class="container">
{{ container_title('Quotes') }}
{% if current_quote is defined %}
<form method="post" action="">
{{ input_csrf('add_quote') }}
{{ input_hidden('quote[id]', current_quote.quote_id|default(0)) }}
* = optional
<table style="color:inherit">
<tr>
<td>Parent ID*</td>
<td>{{ input_text('quote[parent]', '', current_quote.quote_parent|default(quote_parent), 'number') }}</td>
</tr>
<tr>
<td>User ID*</td>
<td>{{ input_text('quote[user][id]', '', current_quote.quote_user_id|default(0), 'number') }}</td>
</tr>
<tr>
<td>Date/time*</td>
<td>{{ input_text('quote[time]', '', (current_quote.quote_timestamp|default('')|date('Y-m-d H:i:s'))) }}</td>
</tr>
<tr>
<td>Username</td>
<td>{{ input_text('quote[user][name]', '', current_quote.quote_username|default(), 'text', '', true) }}</td>
</tr>
<tr>
<td>User Colour</td>
<td>{{ input_text('quote[user][colour]', '', current_quote.quote_user_colour|default(constant('MSZ_COLOUR_INHERIT')), 'number', '', true) }}</td>
</tr>
<tr>
<td colspan="2">
<textarea name="quote[text]" required class="input__textarea">{{ current_quote.quote_text|default() }}</textarea>
</td>
</tr>
</table>
<button class="input__button">Save</button>
</form>
{% elseif quote_set is defined %}
{{ chat_quote_display(quote_set) }}
<a href="?v=quotes&amp;q=-1&amp;s={{ quote_set[0].quote_id }}" class="input__button">Add</a>
Edit:
{% for key, quote in quote_set %}
<a href="?v=quotes&amp;q={{ quote.quote_id }}&amp;s={{ quote_set[0].quote_id }}" class="input__button">{{ key + 1 }} ({{ quote.quote_username }})</a>
{% endfor %}
{% else %}
<a href="?v=quotes&amp;q=-1" class="input__button">Create</a>
{% for parent in quote_parents %}
<div class="container">
{{ container_title(parent.quote_timestamp|date('Y-m-d'), '?v=quotes&s=' ~ parent.quote_id) }}
{{ chat_quote_display([parent]) }}
</div>
{% endfor %}
{{ pagination(quote_count, 15, quote_offset, '?v=quotes') }}
{% endif %}
</div>
{% endblock %}