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 humanize %}
{% load tz %}
{% load utilities %}
<div class="content">
<div id="hide_edit_readthrough_{{ readthrough.id }}" class="box is-shadowless has-background-white-bis">
<div class="columns">
@ -10,14 +11,14 @@
{% if readthrough.finish_date or readthrough.progress %}
<li>
{% if readthrough.finish_date %}
{{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %}
{{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %}
{% else %}
{% if readthrough.progress_mode == 'PG' %}
{% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %}
{% else %}
{{ readthrough.progress }}%
{% endif %}
{% if readthrough.progress_mode == 'PG' %}
{% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %}
{% else %}
{{ readthrough.progress }}%
{% endif %}
{% endif %}
{% if readthrough.progress %}
@ -47,6 +48,7 @@
{% endif %}
</li>
{% endif %}
{% if readthrough.start_date %}
<li>{{ readthrough.start_date | localtime | naturalday }}: {% trans "started" %}</li>
{% endif %}
@ -60,7 +62,11 @@
</div>
<div class="control">
{% 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>
@ -79,4 +85,5 @@
</div>
</form>
</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 %}
{% block modal-title %}{% trans "Delete these read dates?" %}{% endblock %}
{% block modal-body %}
{% 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 %}
{% endblock %}
{% block modal-footer %}
<form name="delete-readthrough-{{ readthrough.id }}" action="/delete-readthrough" method="POST">
{% csrf_token %}
@ -14,7 +20,6 @@
<button class="button is-danger" type="submit">
{% trans "Delete" %}
</button>
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="delete_readthrough" controls_uid=readthrough.id %}
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
</form>
{% endblock %}