2021-01-20 00:16:22 +00:00
{% load bookwyrm_tags %}
2021-05-11 21:41:28 +00:00
{% load utilities %}
2021-05-11 22:14:42 +00:00
{% load status_display %}
2021-05-11 21:41:28 +00:00
2021-02-28 02:48:10 +00:00
{% load i18n %}
2021-01-29 19:14:18 +00:00
< form class = "is-flex-grow-1" name = "{{ type }}" action = "/post/{% if type == 'direct' %}status{% else %}{{ type }}{% endif %}" method = "post" id = "tab-{{ type }}-{{ book.id }}{{ reply_parent.id }}" >
2020-11-06 21:33:26 +00:00
{% csrf_token %}
< input type = "hidden" name = "book" value = "{{ book.id }}" >
< input type = "hidden" name = "user" value = "{{ request.user.id }}" >
2021-04-03 22:47:47 +00:00
< input type = "hidden" name = "reply_parent" value = "{% firstof draft.reply_parent.id reply_parent.id %}" >
2020-11-06 21:33:26 +00:00
{% if type == 'review' %}
2021-04-21 16:34:04 +00:00
< div class = "field" >
2021-02-28 18:09:56 +00:00
< label class = "label" for = "id_name_{{ book.id }}_{{ type }}" > {% trans "Title" %}:< / label >
2021-04-21 16:34:04 +00:00
< div class = "control" >
< input type = "text" name = "name" maxlength = "255" class = "input" required = "" id = "id_name_{{ book.id }}_{{ type }}" placeholder = "My {{ type }} of '{{ book.title }}'" value = "{% firstof draft.name ''%}" >
< / div >
2020-11-06 21:33:26 +00:00
< / div >
{% endif %}
2021-04-21 16:34:04 +00:00
< div class = "field" >
2021-01-29 19:14:18 +00:00
{% if type != 'reply' and type != 'direct' %}
2021-04-21 16:34:04 +00:00
< label class = "label{% if type == 'review' %} mb-0{% endif %}" for = "id_{% if type == 'quotation' %}quote{% else %}content{% endif %}_{{ book.id }}_{{ type }}" >
2021-03-21 00:18:18 +00:00
{% if type == 'comment' %}
{% trans "Comment:" %}
{% elif type == 'quotation' %}
{% trans "Quote:" %}
{% elif type == 'review' %}
{% trans "Review:" %}
{% endif %}
< / label >
2021-01-17 03:57:20 +00:00
{% endif %}
2020-11-06 21:33:26 +00:00
{% if type == 'review' %}
2021-04-21 16:34:04 +00:00
< fieldset class = "mb-1" >
2021-02-28 02:48:10 +00:00
< legend class = "is-sr-only" > {% trans "Rating" %}< / legend >
2021-04-04 13:08:42 +00:00
2021-04-04 16:05:12 +00:00
{% include 'snippets/form_rate_stars.html' with book=book type=type|default:'summary' default_rating=draft.rating %}
2020-11-09 19:33:50 +00:00
< / fieldset >
2020-11-06 21:33:26 +00:00
{% endif %}
2020-12-17 04:10:50 +00:00
2021-04-21 16:34:04 +00:00
< div class = "control" >
{% if type == 'quotation' %}
2021-05-01 14:20:54 +00:00
< textarea
name="quote"
class="textarea"
id="id_quote_{{ book.id }}_{{ type }}"
placeholder="{{ placeholder }}"
required
>{{ draft.quote|default:'' }}< / textarea >
2021-04-21 16:34:04 +00:00
{% else %}
{% include 'snippets/content_warning_field.html' with parent_status=status %}
2021-05-01 14:20:54 +00:00
< textarea
name="content"
class="textarea"
id="id_content_{{ type }}-{{ book.id }}{{reply_parent.id}}"
placeholder="{{ placeholder }}"
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans "Content" %}{% endif %}"
required
>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mention %}@{{ mention|username }} {% endif %}{{ draft.content|default:'' }}< / textarea >
2021-04-21 16:34:04 +00:00
{% endif %}
< / div >
2020-11-06 21:33:26 +00:00
< / div >
2021-04-21 16:34:04 +00:00
{# Supplemental fields #}
2021-01-12 22:02:38 +00:00
{% if type == 'quotation' %}
2021-04-21 16:34:04 +00:00
< div class = "field" >
2021-02-28 18:09:56 +00:00
< label class = "label" for = "id_content_quote-{{ book.id }}" > {% trans "Comment" %}:< / label >
2021-01-17 03:57:20 +00:00
{% include 'snippets/content_warning_field.html' with parent_status=status %}
2021-04-21 16:34:04 +00:00
< div class = "control" >
< textarea name = "content" class = "textarea" rows = "3" id = "id_content_quote-{{ book.id }}" > {{ draft.content|default:'' }}< / textarea >
< / div >
2020-11-06 21:33:26 +00:00
< / div >
2021-03-21 00:18:18 +00:00
{% elif type == 'comment' %}
2021-04-21 16:34:04 +00:00
< div >
2021-03-21 00:18:18 +00:00
{% active_shelf book as active_shelf %}
{% if active_shelf.shelf.identifier == 'reading' and book.latest_readthrough %}
{% with readthrough=book.latest_readthrough %}
< div class = "field" >
2021-03-21 00:34:58 +00:00
< input type = "hidden" name = "id" value = "{{ readthrough.id }}" / >
< label class = "label" for = "progress-{{ uuid }}" > {% trans "Progress:" %}< / label >
2021-03-21 00:18:18 +00:00
< div class = "field has-addons mb-0" >
< div class = "control" >
2021-04-03 22:47:47 +00:00
< input aria-label = "{% if draft.progress_mode == 'PG' or readthrough.progress_mode == 'PG' %}Current page{% else %}Percent read{% endif %}" class = "input" type = "number" min = "0" name = "progress" size = "3" value = "{% firstof draft.progress readthrough.progress '' %}" id = "progress-{{ uuid }}" >
2021-03-21 00:18:18 +00:00
< / div >
2021-04-21 16:34:04 +00:00
< div class = "control" >
< div class = "select" >
< select name = "progress_mode" aria-label = "Progress mode" >
< option value = "PG" { % if draft . progress_mode = = ' PG ' or readthrough . progress_mode = = ' PG ' % } selected { % endif % } > {% trans "pages" %}< / option >
< option value = "PCT" { % if draft . progress_mode = = ' PCT ' or readthrough . progress_mode = = ' PCT ' % } selected { % endif % } > {% trans "percent" %}< / option >
< / select >
< / div >
2021-03-21 00:18:18 +00:00
< / div >
< / div >
{% if readthrough.progress_mode == 'PG' and book.pages %}
< p class = "help" > {% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}< / p >
{% endif %}
< / div >
{% endwith %}
{% endif %}
< / div >
2020-11-06 21:33:26 +00:00
{% endif %}
2021-04-21 16:34:04 +00:00
2021-01-17 03:57:20 +00:00
{# bottom bar #}
2021-04-21 16:34:04 +00:00
< input type = "checkbox" class = "is-hidden" name = "sensitive" id = "id_show_spoilers-{{ uuid }}" { % if draft . content_warning or status . content_warning % } checked { % endif % } aria-hidden = "true" >
2021-05-18 17:45:51 +00:00
2021-04-21 16:34:04 +00:00
< div class = "columns mt-1" >
2021-01-17 03:57:20 +00:00
< div class = "field has-addons column" >
< div class = "control" >
2021-03-01 01:10:30 +00:00
{% trans "Include spoiler alert" as button_text %}
2021-04-03 22:47:47 +00:00
{% firstof draft.content_warning status.content_warning as pressed %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=pressed %}
2021-01-17 03:57:20 +00:00
< / div >
< div class = "control" >
2021-01-29 19:14:18 +00:00
{% if type == 'direct' %}
< input type = "hidden" name = "privacy" value = "direct" >
2021-02-28 02:48:10 +00:00
< button type = "button" class = "button" aria-label = "Privacy" disabled > {% trans "Private" %}< / button >
2021-01-29 19:14:18 +00:00
{% else %}
2021-04-03 22:47:47 +00:00
{% if draft %}
{% include 'snippets/privacy_select.html' with current=draft.privacy %}
{% else %}
2021-01-29 19:14:18 +00:00
{% include 'snippets/privacy_select.html' with current=reply_parent.privacy %}
2021-04-03 22:47:47 +00:00
{% endif %}
2021-01-29 19:14:18 +00:00
{% endif %}
2021-01-17 03:57:20 +00:00
< / div >
< / div >
< div class = "column is-narrow" >
2021-02-28 02:48:10 +00:00
< button class = "button is-link" type = "submit" > {% trans "Post" %}< / button >
2021-01-17 03:57:20 +00:00
< / div >
2020-11-06 21:33:26 +00:00
< / div >
< / form >