Question/poll support

This commit is contained in:
Thomas Sileo
2019-04-14 19:17:54 +02:00
parent 4c0e81224f
commit be7648c9ed
7 changed files with 361 additions and 41 deletions

View File

@@ -12,9 +12,13 @@
<h3 style="padding-bottom: 30px">Replying to {{ content }}</h3>
{{ utils.display_thread(thread) }}
{% else %}
<h3 style="padding-bottom:20px;">New note</h3>
{% if request.args.get("question") == "1" %}
<h3 style="padding-bottom:20px;">New question <small><a href="/admin/new">make it a note?</a></small></h3>
{% else %}
<h3 style="padding-bottom:20px;">New note <small><a href="/admin/new?question=1">make it a question?</a></small></h3>
{% endif %}
<form action="/api/new_note" method="POST" enctype="multipart/form-data">
{% endif %}
<form action="/api/new_{% if request.args.get("question") == "1" %}question{%else%}note{%endif%}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="redirect" value="/">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if reply %}<input type="hidden" name="reply" value="{{reply}}">{% endif %}
@@ -27,7 +31,32 @@
<textarea name="content" rows="10" cols="50" autofocus="autofocus" designMode="on">{{ content }}</textarea>
<input type="file" name="file">
{% if request.args.get("question") == "1" %}
<div style="margin-top:20px;">
<p>Open for: <select name="open_for">
<option value="30">30 minutes</option>
<option value="60">1 hour</option>
<option value="360">6 hour</option>
<option value="1440" selected>1 day</option>
<option value="4320">3 days</option>
<option value="10080">7 days</option>
</select></p>
<input type="hidden" name="of" value="oneOf" />
<!--
<p><select name="of">
<option value="oneOf">Single choice</option>
<option value="anyOf">Multiple choices</option>
</select></p>-->
{% for i in range(4) %}
<p><input type="text" name="answer{{i}}" placeholder="Answer #{{i+1}}"></p>
{% endfor %}
</div>
{% endif %}
<input type="submit" value="post">
</div>
</form>