mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-14 03:05:39 +00:00
Moves add cover into modal
This commit is contained in:
parent
4e55018e41
commit
ae6d8529af
2 changed files with 30 additions and 9 deletions
bookwyrm/templates/book
|
@ -41,15 +41,10 @@
|
||||||
{% include 'snippets/shelve_button/shelve_button.html' %}
|
{% include 'snippets/shelve_button/shelve_button.html' %}
|
||||||
|
|
||||||
{% if request.user.is_authenticated and not book.cover %}
|
{% if request.user.is_authenticated and not book.cover %}
|
||||||
<div class="box p-2">
|
<div class="block">
|
||||||
<h3 class="title is-6 mb-1">{% trans "Add cover" %}</h3>
|
{% trans "Add cover" as button_text %}
|
||||||
<form name="add-cover" method="POST" action="{% url 'upload-cover' book.id %}" enctype="multipart/form-data">
|
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="add-cover" controls_uid=book.id focus="modal-title-add-cover" class="is-small" %}
|
||||||
{% csrf_token %}
|
{% include 'book/cover_modal.html' with book=book controls_text="add-cover" controls_uid=book.id %}
|
||||||
<label class="label">
|
|
||||||
<input type="file" name="cover" accept="image/*" enctype="multipart/form-data" id="id_cover">
|
|
||||||
</label>
|
|
||||||
<button class="button is-small is-primary" type="submit">{% trans "Add" %}</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
26
bookwyrm/templates/book/cover_modal.html
Normal file
26
bookwyrm/templates/book/cover_modal.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{% extends 'components/modal.html' %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block modal-title %}
|
||||||
|
{% trans "Add cover" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block modal-form-open %}
|
||||||
|
<form name="add-cover" method="POST" action="{% url 'upload-cover' book.id %}" enctype="multipart/form-data">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block modal-body %}
|
||||||
|
<section class="modal-card-body">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% csrf_token %}
|
||||||
|
<label class="label">
|
||||||
|
<input type="file" name="cover" accept="image/*" enctype="multipart/form-data" id="id_cover">
|
||||||
|
</label>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block modal-footer %}
|
||||||
|
<button class="button is-primary" type="submit">{% trans "Add" %}</button>
|
||||||
|
{% endblock %}
|
||||||
|
{% block modal-form-close %}</form>{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue