Updates add cover modal

This commit is contained in:
Mouse Reeve 2021-12-30 14:07:30 -08:00
parent 4400c62274
commit 0031a63511
4 changed files with 18 additions and 13 deletions

View file

@ -19,13 +19,8 @@
{% endblock %} {% endblock %}
{% block modal-footer %} {% block modal-footer %}
<button class="button is-primary" type="submit"> <button class="button is-primary" type="submit">{% trans "Confirm" %}</button>
<span>{% trans "Confirm" %}</span> <button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
</button>
<button type="button" class="button" data-modal-close>
{% trans "Cancel" %}
</button>
{% endblock %} {% endblock %}
{% block modal-form-close %}</form>{% endblock %} {% block modal-form-close %}</form>{% endblock %}

View file

@ -63,7 +63,11 @@
<div class="column is-one-fifth"> <div class="column is-one-fifth">
{% if not book.cover %} {% if not book.cover %}
{% if user_authenticated %} {% if user_authenticated %}
<button type="button" data-controls="add_cover_{{ book.id }}" data-focus-target="modal_title_add_cover_{{ book.id }}" aria-pressed="false" class="cover-container no-cover is-h-m-mobile"> <button
type="button"
class="cover-container no-cover is-h-m-mobile"
data-modal-open="add_cover_{{ book.id }}"
>
<img <img
class="book-cover" class="book-cover"
src="{% static "images/no_cover.jpg" %}" src="{% static "images/no_cover.jpg" %}"
@ -78,7 +82,8 @@
{% trans "Click to add cover" %} {% trans "Click to add cover" %}
</span> </span>
</button> </button>
{% include 'book/cover_add_modal.html' with book=book controls_text="add_cover" controls_uid=book.id %} {% join "add_cover" book.id as modal_id %}
{% include 'book/cover_add_modal.html' with id=modal_id %}
{% if request.GET.cover_error %} {% if request.GET.cover_error %}
<p class="help is-danger">{% trans "Failed to load cover" %}</p> <p class="help is-danger">{% trans "Failed to load cover" %}</p>
{% endif %} {% endif %}

View file

@ -1,4 +1,4 @@
{% extends 'components/modal.html' %} {% extends 'components/new_modal.html' %}
{% load i18n %} {% load i18n %}
{% block modal-title %} {% block modal-title %}
@ -29,8 +29,7 @@
{% block modal-footer %} {% block modal-footer %}
<button class="button is-primary" type="submit">{% trans "Add" %}</button> <button class="button is-primary" type="submit">{% trans "Add" %}</button>
{% trans "Cancel" as button_text %} <button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
{% include 'snippets/toggle/toggle_button.html' with text=button_text %}
{% endblock %} {% endblock %}
{% block modal-form-close %}</form>{% endblock %}
{% block modal-form-close %}</form>{% endblock %}

View file

@ -17,6 +17,12 @@ def get_uuid(identifier):
return f"{identifier}{uuid4()}" return f"{identifier}{uuid4()}"
@register.simple_tag(takes_context=False)
def join(*args):
"""concatenate an arbitary set of values"""
return "_".join(str(a) for a in args)
@register.filter(name="username") @register.filter(name="username")
def get_user_identifier(user): def get_user_identifier(user):
"""use localname for local users, username for remote""" """use localname for local users, username for remote"""