Always use underscores in html ids
Plus some other shifting around
This commit is contained in:
49
bookwyrm/templates/snippets/create_status/comment.html
Normal file
49
bookwyrm/templates/snippets/create_status/comment.html
Normal file
@ -0,0 +1,49 @@
|
||||
{% extends "snippets/create_status/layout.html" %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
{% load status_display %}
|
||||
|
||||
{% comment %}
|
||||
----- Variables
|
||||
book: the Edition object this status is related to. Required unless the status is a reply
|
||||
draft: the content of an existing Status object to be edited (used in delete and redraft)
|
||||
uuid: a unique identifier used to make html "id" attributes unique and clarify javascript controls
|
||||
{% endcomment %}
|
||||
|
||||
{% with type="comment" %}
|
||||
{% trans "Some thoughts on the book" as placeholder %}
|
||||
|
||||
{% block post_content_additions %}
|
||||
{# Supplemental fields #}
|
||||
<div>
|
||||
{% active_shelf book as active_shelf %}
|
||||
{% if active_shelf.shelf.identifier == 'reading' and book.latest_readthrough %}
|
||||
|
||||
{% with readthrough=book.latest_readthrough %}
|
||||
<div class="field">
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}"/>
|
||||
<label class="label" for="progress_{{ uuid }}">{% trans "Progress:" %}</label>
|
||||
<div class="field has-addons mb-0">
|
||||
<div class="control">
|
||||
<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 }}">
|
||||
</div>
|
||||
<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>
|
||||
</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>
|
||||
{% endblock %}
|
||||
|
||||
{% endwith %}
|
19
bookwyrm/templates/snippets/create_status/content_field.html
Normal file
19
bookwyrm/templates/snippets/create_status/content_field.html
Normal file
@ -0,0 +1,19 @@
|
||||
{% load i18n %}
|
||||
{% load status_display %}
|
||||
{% load utilities %}
|
||||
{% comment %}
|
||||
type: used to differentiate html id fields when multiple types of posting are available for a book (options: comment, quotation, review, direct, reply)
|
||||
book: the Edition object related to the status
|
||||
reply_parent: if applicable, the Status object that this post is in reply to
|
||||
mention: a user who is @ mentioned by default in the post
|
||||
draft: an existing Status object that is providing default values for input fields
|
||||
{% endcomment %}
|
||||
<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>
|
||||
|
@ -0,0 +1,12 @@
|
||||
{% load i18n %}
|
||||
<div class="control{% if not parent_status.content_warning and not draft.content_warning %} is-hidden{% endif %}" id="spoilers_{{ uuid }}">
|
||||
<label class="is-sr-only" for="id_content_warning_{{ uuid }}">{% trans "Spoiler alert:" %}</label>
|
||||
<input
|
||||
type="text"
|
||||
name="content_warning"
|
||||
maxlength="255"
|
||||
class="input"
|
||||
id="id_content_warning_{{ uuid }}"
|
||||
placeholder="{% trans 'Spoilers ahead!' %}"
|
||||
value="{% firstof draft.content_warning parent_status.content_warning '' %}">
|
||||
</div>
|
@ -0,0 +1,8 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="control">
|
||||
<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">
|
||||
{% trans "Include spoiler alert" as button_text %}
|
||||
{% 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 %}
|
||||
</div>
|
7
bookwyrm/templates/snippets/create_status/direct.html
Normal file
7
bookwyrm/templates/snippets/create_status/direct.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "snippets/create_status/layout.html" %}
|
||||
{# ----- Variables -----
|
||||
type: the format of the status. options are "comment" "quotation" "review" "direct" "reply"
|
||||
mention: the User object of a user who will show up at @ mentioned by default
|
||||
draft: the content of an existing Status object to be edited (used in delete and redraft)
|
||||
uuid: a unique identifier used to make html "id" attributes unique and clarify javascript controls
|
||||
#}
|
57
bookwyrm/templates/snippets/create_status/layout.html
Normal file
57
bookwyrm/templates/snippets/create_status/layout.html
Normal file
@ -0,0 +1,57 @@
|
||||
{% load bookwyrm_tags %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
{% load status_display %}
|
||||
|
||||
{% comment %}
|
||||
----- Variables
|
||||
book: the Edition object this status is related to. Required unless the status is a reply
|
||||
draft: the content of an existing Status object to be edited (used in delete and redraft)
|
||||
uuid: a unique identifier used to make html "id" attributes unique and clarify javascript controls
|
||||
type: used for uniquely identifying the html elements when mutliple types of posts are available for a book, and usually the endpoint name that the form posts to
|
||||
reply_parent: the Status object this post will be in reply to, if applicable
|
||||
{% endcomment %}
|
||||
|
||||
{% block form_open %}
|
||||
{# default form tag syntax, can be overriddden #}
|
||||
<form class="is-flex-grow-1" name="{{ type }}" action="/post/{{ type }}" method="post" id="tab_{{ type }}_{{ book.id }}{{ reply_parent.id }}">
|
||||
{% endblock %}
|
||||
|
||||
{% csrf_token %}
|
||||
|
||||
{% block initial_fields %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
||||
<input type="hidden" name="reply_parent" value="{% firstof draft.reply_parent.id reply_parent.id %}">
|
||||
{% endblock %}
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
{% include "snippets/create_status/content_warning_field.html" %}
|
||||
</div>
|
||||
|
||||
{# fields that go between the content warnings and the content field (ie, quote) #}
|
||||
{% block pre_content_additions %}{% endblock %}
|
||||
|
||||
<label class="label" for="id_content_{{ type }}_{{ book.id }}{{ reply_parent.id }}">
|
||||
{% block content_label %}
|
||||
{% trans "Comment:" %}
|
||||
{% endblock %}
|
||||
</label>
|
||||
|
||||
<div class="control">
|
||||
{% include "snippets/create_status/content_field.html" with placeholder=placeholder %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# additional fields that go after the content block (ie, progress) #}
|
||||
{% block post_content_additions %}{% endblock %}
|
||||
|
||||
{% block options_block %}
|
||||
{# cw, post privacy, and submit button #}
|
||||
{% include "snippets/create_status/post_options_block.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block form_close %}
|
||||
</form>
|
||||
{% endblock %}
|
@ -0,0 +1,22 @@
|
||||
{% load i18n %}
|
||||
<div class="columns mt-1">
|
||||
<div class="field has-addons column">
|
||||
{% include "snippets/create_status/content_warning_toggle.html" %}
|
||||
<div class="control">
|
||||
{% if type == 'direct' %}
|
||||
<input type="hidden" name="privacy" value="direct">
|
||||
<button type="button" class="button" aria-label="Privacy" disabled>{% trans "Private" %}</button>
|
||||
{% else %}
|
||||
{% if draft %}
|
||||
{% include 'snippets/privacy_select.html' with current=draft.privacy %}
|
||||
{% else %}
|
||||
{% include 'snippets/privacy_select.html' with current=reply_parent.privacy %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
<button class="button is-link" type="submit">{% trans "Post" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
34
bookwyrm/templates/snippets/create_status/quotation.html
Normal file
34
bookwyrm/templates/snippets/create_status/quotation.html
Normal file
@ -0,0 +1,34 @@
|
||||
{% extends "snippets/create_status/layout.html" %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% load utilities %}
|
||||
{% load status_display %}
|
||||
{% load i18n %}
|
||||
|
||||
{% comment %}
|
||||
----- Variables
|
||||
book: the Edition object this status is related to. Required unless the status is a reply
|
||||
draft: the content of an existing Status object to be edited (used in delete and redraft)
|
||||
uuid: a unique identifier used to make html "id" attributes unique and clarify javascript controls
|
||||
{% endcomment %}
|
||||
|
||||
{% with type="quotation" %}
|
||||
|
||||
{% block pre_content_additions %}
|
||||
<div class="field">
|
||||
<label class="label" for="id_quote_{{ book.id }}_{{ type }}">
|
||||
{% trans "Quote:" %}
|
||||
</label>
|
||||
|
||||
<div class="control">
|
||||
<textarea
|
||||
name="quote"
|
||||
class="textarea"
|
||||
id="id_quote_{{ book.id }}_{{ type }}"
|
||||
placeholder="{% blocktrans with book_title=book.title %}An excerpt from '{{ book_title }}'{% endblocktrans %}"
|
||||
required
|
||||
>{{ draft.quote|default:'' }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% endwith %}
|
10
bookwyrm/templates/snippets/create_status/reply.html
Normal file
10
bookwyrm/templates/snippets/create_status/reply.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% extends "snippets/create_status/layout.html" %}
|
||||
{# ----- Variables -----
|
||||
reply_parent: the parent status, if the status is a reply
|
||||
type: the format of the status. options are "comment" "quotation" "review" "direct" "reply"
|
||||
mention: the User object of a user who will show up at @ mentioned by default
|
||||
draft: the content of an existing Status object to be edited (used in delete and redraft)
|
||||
uuid: a unique identifier used to make html "id" attributes unique and clarify javascript controls
|
||||
#}
|
||||
|
||||
{% block content_label %}{% endblock %}
|
35
bookwyrm/templates/snippets/create_status/review.html
Normal file
35
bookwyrm/templates/snippets/create_status/review.html
Normal file
@ -0,0 +1,35 @@
|
||||
{% extends "snippets/create_status/layout.html" %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% load utilities %}
|
||||
{% load status_display %}
|
||||
{% load i18n %}
|
||||
|
||||
{% comment %}
|
||||
----- Variables
|
||||
book: the Edition object this status is related to. Required unless the status is a reply
|
||||
draft: the content of an existing Status object to be edited (used in delete and redraft)
|
||||
uuid: a unique identifier used to make html "id" attributes unique and clarify javascript controls
|
||||
{% endcomment %}
|
||||
|
||||
{% with type="review" %}
|
||||
|
||||
{% block pre_content_additions %}
|
||||
<div class="field">
|
||||
<label class="label" for="id_name_{{ book.id }}">{% trans "Title:" %}</label>
|
||||
<div class="control">
|
||||
<input type="text" name="name" maxlength="255" class="input" required="" id="id_name_{{ book.id }}" placeholder="{% blocktrans with book_title=book.title %}Your review of '{{ book_title }}'{% endblocktrans %}" value="{% firstof draft.name ''%}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="mb-1">
|
||||
<legend class="is-sr-only">{% trans "Rating" %}</legend>
|
||||
|
||||
{% include 'snippets/form_rate_stars.html' with book=book type=type|default:'summary' default_rating=draft.rating %}
|
||||
</fieldset>
|
||||
{% endblock %}
|
||||
|
||||
{% block content_label %}
|
||||
{% trans "Review:" %}
|
||||
{% endblock %}
|
||||
|
||||
{% endwith %}
|
2
bookwyrm/templates/snippets/create_status/status.html
Normal file
2
bookwyrm/templates/snippets/create_status/status.html
Normal file
@ -0,0 +1,2 @@
|
||||
{# allows the "type" variable to inherit properly to the layout #}
|
||||
{% include 'snippets/create_status/'|add:type|add:'.html' %}
|
Reference in New Issue
Block a user