nekrochan/templates/macros/post-form.html

106 řádky
4.4 KiB
HTML

{% macro post_form(board, reply, reply_to) %}
<form id="post-form" method="post" enctype="multipart/form-data" action="/actions/create-post" autocomplete="off" data-visible="false">
<input name="board" type="hidden" value="{{ board.id }}">
{% if reply %}
<input name="thread" type="hidden" value="{{ reply_to }}">
{% endif %}
<table class="form-table">
<tr>
<td id="post-form-handle" class="label center" colspan="2">
{% if reply %}
Nová odpověď
{% else %}
Nové vlákno
{% endif %}
<a class="close-post-form float-r" href="#">[X]</a>
</td>
</tr>
<tr>
<td class="label">Jméno</td>
<td>
<input name="post_name" type="text" placeholder="{{ board.config.0.anon_name }}">
</td>
</tr>
<tr>
<td class="label">Email</td>
<td>
<input name="email" type="text">
</td>
</tr>
<tr>
<td class="label">Obsah</td>
<td>
<textarea id="content" name="content" {% if (!reply && board.config.0.require_thread_content) || (reply && board.config.0.require_reply_content) %}required=""{% endif %}></textarea>
</td>
</tr>
{% if !(tcx.perms.bypass_captcha() || tcx.perms.owner()) %}
{% let difficulty %}
{% if reply %}
{% let difficulty = board.config.0.reply_captcha.as_str() %}
{% else %}
{% let difficulty = board.config.0.thread_captcha.as_str() %}
{% endif %}
{% if (!reply && board.config.0.thread_captcha != "off") || (reply && board.config.0.reply_captcha != "off") %}
<tr>
<td class="label">
CAPTCHA<br>
<span class="small">(vyprší za 10 min.)</span>
<noscript><span class="small">(VYŽADUJE JAVASCRIPT)</span></noscript>
</td>
<td>
<div class="input-wrapper">
<table class="full-width">
<input id="captcha-id" name="captcha_id" type="hidden">
<tr>
<td>
<button id="get-captcha" type="button" class="button" data-board="{{ board.id }}" data-reply="{{ reply }}">Získat CAPTCHA</button>
</td>
<td>
<input name="captcha_solution" type="text" placeholder="Řešení" value="" required="">
</tr>
</tr>
<tr><td colspan="2"><div id="captcha"></div></tr>
</table>
</div>
</td>
</tr>
{% endif %}
{% endif %}
<tr>
<td class="label">
{% if board.config.0.file_limit > 1 %}
Soubory <span class="small">(max {{ board.config.0.file_limit }})</span>
{% else %}
Soubor
{% endif %}
</td>
<td>
<div class="input-wrapper">
<input name="files[]" type="file"{% if board.config.0.file_limit > 1 %} multiple="multiple"{% endif %}{% if (!reply && board.config.0.require_thread_file) || (reply && board.config.0.require_reply_file) %} required=""{% endif %}>
</div>
</td>
</tr>
<tr>
<td class="label">Spoiler?</td>
<td>
<div class="input-wrapper">
<input class="full-width" name="spoiler_files" type="checkbox">
</div>
</td>
</tr>
<tr>
<td class="label">Heslo</td>
<td><input name="post_password" type="password" required=""></td>
</tr>
<tr>
{% if reply %}
<td colspan="2"><input class="button" type="submit" value="Nová odpověď"></td>
{% else %}
<td colspan="2"><input class="button" type="submit" value="Nové vlákno"></td>
{% endif %}
</tr>
</table>
</form>
{% endmacro %}