mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-03-27 05:43:24 +00:00
Menu list for shelf button options
This commit is contained in:
parent
9b7c10ce6c
commit
e5746d6117
5 changed files with 24 additions and 36 deletions
|
@ -13,6 +13,13 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- SHELVING --- */
|
||||||
|
.shelf-option:disabled > *::after {
|
||||||
|
font-family: "icomoon";
|
||||||
|
content: "\e918";
|
||||||
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
/* --- TOGGLES --- */
|
/* --- TOGGLES --- */
|
||||||
.toggle-button[aria-pressed=true], .toggle-button[aria-pressed=true]:hover {
|
.toggle-button[aria-pressed=true], .toggle-button[aria-pressed=true]:hover {
|
||||||
background-color: hsl(171, 100%, 41%);
|
background-color: hsl(171, 100%, 41%);
|
||||||
|
|
|
@ -10,22 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="control">
|
<div class="control">
|
||||||
{% if active_shelf.shelf.identifier == 'read' %}
|
{% include 'snippets/shelve_button_options.html' with class="shelf-option is-small" shelves=request.user.shelf_set.all active_shelf=active_shelf %}
|
||||||
<button class="button is-small" disabled>
|
|
||||||
<span>Read</span> <span class="icon icon-check"></span>
|
|
||||||
</button>
|
|
||||||
{% elif active_shelf.shelf.identifier == 'reading' %}
|
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="I'm done!" controls_text="finish-reading" controls_uid=uuid focus="modal-title-finish-reading" %}
|
|
||||||
{% elif active_shelf.shelf.identifier == 'to-read' %}
|
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="Start reading" controls_text="start-reading" controls_uid=uuid focus="modal-title-start-reading" %}
|
|
||||||
{% else %}
|
|
||||||
<form name="shelve" action="/shelve/" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
|
||||||
<input type="hidden" name="shelf" value="to-read">
|
|
||||||
<button class="button is-small" type="submit">Want to read</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% include 'snippets/shelve_button_dropdown.html' with class="is-small" button_uuid=uuid%}
|
{% include 'snippets/shelve_button_dropdown.html' with class="is-small" button_uuid=uuid%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -6,23 +6,5 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block dropdown-list %}
|
{% block dropdown-list %}
|
||||||
{% for shelf in request.user.shelf_set.all %}
|
{% include 'snippets/shelve_button_options.html' with active_shelf=active_shelf shelves=request.user.shelf_set.all dropdown=True class="shelf-option is-fullwidth is-small" %}
|
||||||
<li role="menuitem">
|
|
||||||
{% if active_shelf.shelf.identifier != 'reading' and shelf.identifier == 'reading' %}
|
|
||||||
<div class="dropdown-item pt-0 pb-0">
|
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class="is-fullwidth is-small" text="Start reading" controls_text="start-reading" controls_uid=button_uuid focus="modal-title-start-reading" %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
|
||||||
<button class="button is-fullwidth is-small" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>
|
|
||||||
<span>{{ shelf.name }}</span>
|
|
||||||
{% if shelf in book.shelf_set.all %}<span class="icon icon-check"></span>{% endif %}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
{% if checkbox %}data-controls-checkbox="{{ checkbox }}{% if controls_uid %}-{{ controls_uid }}{% endif %}"{% endif %}
|
{% if checkbox %}data-controls-checkbox="{{ checkbox }}{% if controls_uid %}-{{ controls_uid }}{% endif %}"{% endif %}
|
||||||
{% if label %}aria-label="{{ label }}"{% endif %}
|
{% if label %}aria-label="{{ label }}"{% endif %}
|
||||||
aria-pressed="{% if pressed %}true{% else %}false{% endif %}"
|
aria-pressed="{% if pressed %}true{% else %}false{% endif %}"
|
||||||
|
{% if disabled %}disabled{% endif %}
|
||||||
>
|
>
|
||||||
|
|
||||||
{% if icon %}
|
{% if icon %}
|
||||||
|
@ -13,6 +14,6 @@
|
||||||
<span class="is-sr-only">{{ text }}</span>
|
<span class="is-sr-only">{{ text }}</span>
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ text }}
|
<span>{{ text }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -159,6 +159,14 @@ def get_status_preview_name(obj):
|
||||||
return '%s from <em>%s</em>' % (name, obj.book.title)
|
return '%s from <em>%s</em>' % (name, obj.book.title)
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
@register.filter(name='next_shelf')
|
||||||
|
def get_next_shelf(current_shelf):
|
||||||
|
if current_shelf == 'to-read':
|
||||||
|
return 'reading'
|
||||||
|
if current_shelf == 'reading':
|
||||||
|
return 'read'
|
||||||
|
return 'to-read'
|
||||||
|
|
||||||
@register.simple_tag(takes_context=False)
|
@register.simple_tag(takes_context=False)
|
||||||
def related_status(notification):
|
def related_status(notification):
|
||||||
''' for notifications '''
|
''' for notifications '''
|
||||||
|
@ -199,3 +207,8 @@ def active_read_through(book, user):
|
||||||
book=book,
|
book=book,
|
||||||
finish_date__isnull=True
|
finish_date__isnull=True
|
||||||
).order_by('-start_date').first()
|
).order_by('-start_date').first()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=False)
|
||||||
|
def comparison_bool(str1, str2):
|
||||||
|
return str1 == str2
|
||||||
|
|
Loading…
Reference in a new issue