mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Logic for rendering a particular compose tab server-side
This commit is contained in:
parent
fb900d58cd
commit
029913de32
1 changed files with 35 additions and 9 deletions
|
@ -2,36 +2,62 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
|
|
||||||
|
{% with status_type=request.GET.status_type %}
|
||||||
<div class="tab-group">
|
<div class="tab-group">
|
||||||
<div class="tabs is-boxed" role="tablist">
|
<div class="tabs is-boxed" role="tablist">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="is-active">
|
<li class="{% if status_type == 'review' or not status_type %}is-active{% endif %}">
|
||||||
<a href="#review-{{ book.id }}" id="tab-review-{{ book.id }}" role="tab" aria-selected="true" aria-controls="review-{{ book.id }}" data-category="tab-option-{{ book.id }}">{% trans "Review" %}</a>
|
<a
|
||||||
|
href="{{ request.path }}?status_type=review&book={{ book.id }}"
|
||||||
|
id="tab-review-{{ book.id }}"
|
||||||
|
role="tab"
|
||||||
|
aria-selected="{% if status_type == 'review' or not status_type %}true{% else %}false{% endif %}"
|
||||||
|
aria-controls="review-{{ book.id }}"
|
||||||
|
data-category="tab-option-{{ book.id }}">
|
||||||
|
{% trans "Review" %}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li class="{% if status_type == 'comment' %}is-active{% endif %}">
|
||||||
<a href="#comment-{{ book.id}}" id="tab-comment-{{ book.id }}" role="tab" aria-selected="false" aria-controls="comment-{{ book.id}}" data-category="tab-option-{{ book.id }}">{% trans "Comment" %}</a>
|
<a
|
||||||
|
href="{{ request.path }}?status_type=comment&book={{ book.id}}"
|
||||||
|
id="tab-comment-{{ book.id }}"
|
||||||
|
role="tab"
|
||||||
|
aria-selected="{% if status_type == 'comment' %}true{% else %}false{% endif %}"
|
||||||
|
aria-controls="comment-{{ book.id}}"
|
||||||
|
data-category="tab-option-{{ book.id }}">
|
||||||
|
{% trans "Comment" %}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li class="{% if status_type == 'quote' %}is-active{% endif %}">
|
||||||
<a href="#quote-{{ book.id }}" id="tab-quote-{{ book.id }}" role="tab" aria-selected="false" aria-controls="quote-{{ book.id }}" data-category="tab-option-{{ book.id }}">{% trans "Quote" %}</a>
|
<a
|
||||||
|
href="{{ request.path }}?status_type=quote&book={{ book.id }}"
|
||||||
|
id="tab-quote-{{ book.id }}"
|
||||||
|
role="tab"
|
||||||
|
aria-selected="{% if status_type == 'quote' %}true{% else %}false{% endif %}"
|
||||||
|
aria-controls="quote-{{ book.id }}"
|
||||||
|
data-category="tab-option-{{ book.id }}">
|
||||||
|
{% trans "Quote" %}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-option-{{ book.id }}" id="review-{{ book.id }}" role="tabpanel" aria-labelledby="tab-review-{{ book.id }}">
|
<div class="tab-option-{{ book.id }}" id="review-{{ book.id }}" role="tabpanel" aria-labelledby="tab-review-{{ book.id }}" {% if status_type and status_type != "review" %}hidden{% endif %}>
|
||||||
{% with 0|uuid as uuid %}
|
{% with 0|uuid as uuid %}
|
||||||
{% include 'snippets/create_status_form.html' with type='review' %}
|
{% include 'snippets/create_status_form.html' with type='review' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-option-{{ book.id }}" id="comment-{{ book.id }}" role="tabpanel" aria-labelledby="tab-comment-{{ book.id }}" hidden>
|
<div class="tab-option-{{ book.id }}" id="comment-{{ book.id }}" role="tabpanel" aria-labelledby="tab-comment-{{ book.id }}" {% if status_type != "comment" %}hidden{% endif %}>
|
||||||
{% with 0|uuid as uuid %}
|
{% with 0|uuid as uuid %}
|
||||||
{% include 'snippets/create_status_form.html' with type="comment" placeholder="Some thoughts on '"|add:book.title|add:"'" %}
|
{% include 'snippets/create_status_form.html' with type="comment" placeholder="Some thoughts on '"|add:book.title|add:"'" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-option-{{ book.id }}" id="quote-{{ book.id }}" role="tabpanel" aria-labelledby="tab-quote-{{ book.id }}" hidden>
|
<div class="tab-option-{{ book.id }}" id="quote-{{ book.id }}" role="tabpanel" aria-labelledby="tab-quote-{{ book.id }}" {% if status_type != "quote" %}hidden{% endif %}>
|
||||||
{% with 0|uuid as uuid %}
|
{% with 0|uuid as uuid %}
|
||||||
{% include 'snippets/create_status_form.html' with type="quotation" placeholder="An excerpt from '"|add:book.title|add:"'" %}
|
{% include 'snippets/create_status_form.html' with type="quotation" placeholder="An excerpt from '"|add:book.title|add:"'" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endwith %}
|
||||||
|
|
Loading…
Reference in a new issue