mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 21:11:16 +00:00
Simplify markup for creating status
This commit is contained in:
parent
9ef63fff4a
commit
404ec82657
3 changed files with 44 additions and 78 deletions
|
@ -17,89 +17,15 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input class="toggle-control" type="radio" name="status-tabs-{{ book.id }}" id="review-{{ book.id }}" checked>
|
<input class="toggle-control" type="radio" name="status-tabs-{{ book.id }}" id="review-{{ book.id }}" checked>
|
||||||
<form class="toggle-content hidden tab-option-{{ book.id }}" name="review" action="/review/" method="post" id="tab-review-{{ book.id }}">
|
{% include 'snippets/create_status_form.html' with type='review' %}
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
|
||||||
<div class="control">
|
|
||||||
<label class="label" for="id_name_{{ book.id }}_review">Title:</label>
|
|
||||||
<input type="text" name="name" maxlength="255" class="input" required="" id="id_name_{{ book.id }}_review" placeholder="My review of '{{ book.title }}'">
|
|
||||||
</div>
|
|
||||||
<div class="control">
|
|
||||||
<label class="label" for="id_content_{{ book.id }}_review">Review:</label>
|
|
||||||
|
|
||||||
<span class="is-sr-only">Rating</span>
|
|
||||||
<div class="field is-grouped stars form-rate-stars">
|
|
||||||
<input class="hidden" type="radio" name="rating" value="" checked>
|
|
||||||
{% for i in '12345'|make_list %}
|
|
||||||
<input class="hidden" id="book{{book.id}}-star-{{ forloop.counter }}" type="radio" name="rating" value="{{ forloop.counter }}">
|
|
||||||
<label class="icon icon-star-empty" for="book{{book.id}}-star-{{ forloop.counter }}">
|
|
||||||
<span class="is-sr-only">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>
|
|
||||||
</label>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<textarea name="content" class="textarea" id="id_content_{{ book.id }}_review"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="control is-grouped">
|
|
||||||
{% include 'snippets/privacy_select.html' %}
|
|
||||||
<button class="button is-primary" type="submit">post review</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input class="toggle-control" type="radio" name="status-tabs-{{ book.id }}" id="comment-{{ book.id }}">
|
<input class="toggle-control" type="radio" name="status-tabs-{{ book.id }}" id="comment-{{ book.id }}">
|
||||||
<form class="toggle-content hidden tab-option-{{ book.id }}" name="comment" action="/comment/" method="post" id="tab-comment-{{ book.id }}">
|
{% include 'snippets/create_status_form.html' with type="comment" placeholder="Some thougts on '"|add:book.title|add:"'" %}
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
|
||||||
<input type="hidden" name="privacy" value="public">
|
|
||||||
<div class="control">
|
|
||||||
<label class="label" for="id_content_{{ book.id }}_comment">Comment:</label>
|
|
||||||
<textarea name="content" class="textarea" id="id_content_{{ book.id }}_comment" placeholder="Some thoughts on '{{ book.title }}'"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="control is-grouped">
|
|
||||||
<div class="select">
|
|
||||||
<select name="privacy">
|
|
||||||
<option value="public" selected>Public</option>
|
|
||||||
<option value="unlisted">Unlisted</option>
|
|
||||||
<option value="followers">Followers only</option>
|
|
||||||
<option value="direct">Private</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<button class="button is-primary" type="submit">post comment</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input class="toggle-control" type="radio" name="status-tabs-{{ book.id }}" id="quote-{{ book.id }}">
|
<input class="toggle-control" type="radio" name="status-tabs-{{ book.id }}" id="quote-{{ book.id }}">
|
||||||
<form class="toggle-content hidden tab-option-{{ book.id }}" name="quotation" action="/quotate/" method="post" id="tab-quotation-{{ book.id }}">
|
{% include 'snippets/create_status_form.html' with type="quote" placeholder="An excerpt from '"|add:book.title|add:"'" %}
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
|
||||||
<input type="hidden" name="privacy" value="public">
|
|
||||||
<div class="control">
|
|
||||||
<label class="label" for="id_quote_{{ book.id }}_quote">Quote:</label>
|
|
||||||
<textarea name="quote" class="textarea" required="" id="id_quote_{{ book.id }}_quote" placeholder="An except from '{{ book.title }}'"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="control">
|
|
||||||
<label class="label" for="id_content_{{ book.id }}_quote">Comment:</label>
|
|
||||||
<textarea name="content" class="textarea is-small" id="id_content_{{ book.id }}_quote"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="control is-grouped">
|
|
||||||
<div class="select">
|
|
||||||
<select name="privacy">
|
|
||||||
<option value="public" selected>Public</option>
|
|
||||||
<option value="unlisted">Unlisted</option>
|
|
||||||
<option value="followers">Followers only</option>
|
|
||||||
<option value="direct">Private</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<button class="button is-primary" type="submit">post quote</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
40
bookwyrm/templates/snippets/create_status_form.html
Normal file
40
bookwyrm/templates/snippets/create_status_form.html
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<form class="toggle-content hidden tab-option-{{ book.id }}" name="{{ type }}" action="/{{ type }}" method="post" id="tab-{{ type }}-{{ book.id }}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="book" value="{{ book.id }}">
|
||||||
|
<input type="hidden" name="user" value="{{ request.user.id }}">
|
||||||
|
{% if type == 'review' %}
|
||||||
|
<div class="control">
|
||||||
|
<label class="label" for="id_name_{{ book.id }}_{{ type }}">Title:</label>
|
||||||
|
<input type="text" name="name" maxlength="255" class="input" required="" id="id_name_{{ book.id }}_{{ type }}" placeholder="My {{ type }} of '{{ book.title }}'">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="control">
|
||||||
|
<label class="label" for="id_content_{{ book.id }}_{{ type }}">{{ type|title }}:</label>
|
||||||
|
|
||||||
|
{% if type == 'review' %}
|
||||||
|
<span class="is-sr-only">Rating</span>
|
||||||
|
<div class="field is-grouped stars form-rate-stars">
|
||||||
|
<input class="hidden" type="radio" name="rating" value="" checked>
|
||||||
|
{% for i in '12345'|make_list %}
|
||||||
|
<input class="hidden" id="book{{book.id}}-star-{{ forloop.counter }}" type="radio" name="rating" value="{{ forloop.counter }}">
|
||||||
|
<label class="icon icon-star-empty" for="book{{book.id}}-star-{{ forloop.counter }}">
|
||||||
|
<span class="is-sr-only">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<textarea name="{% if type == 'quote' %}quote{% else %}content{% endif %}" class="textarea" id="id_content_{{ book.id }}_{{ type }}" placeholder="{{ placeholder }}" required></textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% if type == 'quote' %}
|
||||||
|
<div class="control">
|
||||||
|
<label class="label" for="id_content_{{ book.id }}_quote">Comment:</label>
|
||||||
|
<textarea name="content" class="textarea is-small" id="id_content_{{ book.id }}_quote"></textarea>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="control is-grouped">
|
||||||
|
{% include 'snippets/privacy_select.html' %}
|
||||||
|
<button class="button is-primary" type="submit">post {{ type }}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
|
@ -107,7 +107,7 @@ urlpatterns = [
|
||||||
|
|
||||||
re_path(r'^rate/?$', actions.rate),
|
re_path(r'^rate/?$', actions.rate),
|
||||||
re_path(r'^review/?$', actions.review),
|
re_path(r'^review/?$', actions.review),
|
||||||
re_path(r'^quotate/?$', actions.quotate),
|
re_path(r'^quote/?$', actions.quotate),
|
||||||
re_path(r'^comment/?$', actions.comment),
|
re_path(r'^comment/?$', actions.comment),
|
||||||
re_path(r'^tag/?$', actions.tag),
|
re_path(r'^tag/?$', actions.tag),
|
||||||
re_path(r'^untag/?$', actions.untag),
|
re_path(r'^untag/?$', actions.untag),
|
||||||
|
|
Loading…
Reference in a new issue