misuzu/templates/manage/general/quotes.twig

73 lines
3.2 KiB
Twig

{% extends 'manage/general/master.twig' %}
{% from 'home/macros.twig' import chat_quote_display %}
{% from 'macros.twig' import pagination %}
{% block manage_content %}
<div class="container">
<div class="container__title">Quotes</div>
{% if current_quote is defined %}
<form method="post" action="">
{{ 'add_quote'|csrf|raw }}
<input type="hidden" name="quote[id]" value="{{ current_quote.quote_id|default(0) }}">
* = optional
<table style="color:inherit">
<tr>
<td>Parent ID*</td>
<td><input type="number" name="quote[parent]" value="{{ current_quote.quote_parent|default(quote_parent) }}" class="input__text"></td>
</tr>
<tr>
<td>User ID*</td>
<td><input type="number" name="quote[user][id]" class="input__text" value="{{ current_quote.quote_user_id|default(0) }}"></td>
</tr>
<tr>
<td>Date/time*</td>
<td><input type="text" name="quote[time]" class="input__text" value="{{ current_quote.quote_timestamp|default(0)|date('Y-m-d H:i:s') }}"></td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" required name="quote[user][name]" class="input__text" value="{{ current_quote.quote_username|default() }}"></td>
</tr>
<tr>
<td>User Colour</td>
<td><input type="number" required name="quote[user][colour]" class="input__text" value="{{ current_quote.quote_user_colour|default(constant('MSZ_COLOUR_INHERIT')) }}"></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">
<a href="?v=quotes&amp;s={{ parent.quote_id }}" class="container__title container__title--link">{{ parent.quote_timestamp|date('Y-m-d') }}</a>
{{ chat_quote_display([parent]) }}
</div>
{% endfor %}
{{ pagination(quote_count, 15, quote_offset, '?v=quotes') }}
{% endif %}
</div>
{% endblock %}