Readthrough delete modal

This commit is contained in:
Mouse Reeve 2021-12-30 17:48:09 -08:00
parent c6b5ecc418
commit 7af4af278d
2 changed files with 24 additions and 12 deletions

View file

@ -1,6 +1,7 @@
{% load i18n %} {% load i18n %}
{% load humanize %} {% load humanize %}
{% load tz %} {% load tz %}
{% load utilities %}
<div class="content"> <div class="content">
<div id="hide_edit_readthrough_{{ readthrough.id }}" class="box is-shadowless has-background-white-bis"> <div id="hide_edit_readthrough_{{ readthrough.id }}" class="box is-shadowless has-background-white-bis">
<div class="columns"> <div class="columns">
@ -10,14 +11,14 @@
{% if readthrough.finish_date or readthrough.progress %} {% if readthrough.finish_date or readthrough.progress %}
<li> <li>
{% if readthrough.finish_date %} {% if readthrough.finish_date %}
{{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %} {{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %}
{% else %} {% else %}
{% if readthrough.progress_mode == 'PG' %} {% if readthrough.progress_mode == 'PG' %}
{% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %} {% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %}
{% else %} {% else %}
{{ readthrough.progress }}% {{ readthrough.progress }}%
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if readthrough.progress %} {% if readthrough.progress %}
@ -47,6 +48,7 @@
{% endif %} {% endif %}
</li> </li>
{% endif %} {% endif %}
{% if readthrough.start_date %} {% if readthrough.start_date %}
<li>{{ readthrough.start_date | localtime | naturalday }}: {% trans "started" %}</li> <li>{{ readthrough.start_date | localtime | naturalday }}: {% trans "started" %}</li>
{% endif %} {% endif %}
@ -60,7 +62,11 @@
</div> </div>
<div class="control"> <div class="control">
{% trans "Delete these read dates" as button_text %} {% trans "Delete these read dates" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text=button_text icon="x" controls_text="delete_readthrough" controls_uid=readthrough.id focus="modal_title_delete_readthrough" %} <button class="button is-small" type="button" data-modal-open="delete_readthrough_{{ readthrough.id }}">
<span class="icon icon-x" title="{{ button_text }}">
<span class="is-sr-only">{{ button_text }}</span>
</span>
</button>
</div> </div>
</div> </div>
</div> </div>
@ -79,4 +85,5 @@
</div> </div>
</form> </form>
</div> </div>
{% include 'snippets/delete_readthrough_modal.html' with controls_text="delete_readthrough" controls_uid=readthrough.id no_body=True %} {% join "delete_readthrough" readthrough.id as modal_id %}
{% include 'snippets/delete_readthrough_modal.html' with id=modal_id %}

View file

@ -1,12 +1,18 @@
{% extends 'components/modal.html' %} {% extends 'components/new_modal.html' %}
{% load i18n %} {% load i18n %}
{% block modal-title %}{% trans "Delete these read dates?" %}{% endblock %} {% block modal-title %}{% trans "Delete these read dates?" %}{% endblock %}
{% block modal-body %} {% block modal-body %}
{% if readthrough.progress_updates|length > 0 %} {% if readthrough.progress_updates|length > 0 %}
{% blocktrans with count=readthrough.progress_updates|length %}You are deleting this readthrough and its {{ count }} associated progress updates.{% endblocktrans %} {% blocktrans trimmed with count=readthrough.progress_updates|length %}
You are deleting this readthrough and its {{ count }} associated progress updates.
{% endblocktrans %}
{% else %}
{% trans "This action cannot be un-done" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block modal-footer %} {% block modal-footer %}
<form name="delete-readthrough-{{ readthrough.id }}" action="/delete-readthrough" method="POST"> <form name="delete-readthrough-{{ readthrough.id }}" action="/delete-readthrough" method="POST">
{% csrf_token %} {% csrf_token %}
@ -14,7 +20,6 @@
<button class="button is-danger" type="submit"> <button class="button is-danger" type="submit">
{% trans "Delete" %} {% trans "Delete" %}
</button> </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 controls_text="delete_readthrough" controls_uid=readthrough.id %}
</form> </form>
{% endblock %} {% endblock %}