manager: use dedicated template for exception deletion confirm page (#38511)

This commit is contained in:
Frédéric Péters 2019-12-13 16:09:59 +01:00
parent 5bc475c663
commit 30cb3f672f
4 changed files with 27 additions and 8 deletions

View File

@ -2,7 +2,7 @@
{% load i18n %}
{% block appbar %}
<h2>{{ object }}</h2>
<h2>{{ view.model.get_verbose_name }}</h2>
{% endblock %}
{% block content %}
@ -13,7 +13,7 @@
{% blocktrans %}This cannot be removed as there are bookings for a future date.
{% endblocktrans %}
{% else %}
{% blocktrans %}Are you sure you want to delete this exception?{% endblocktrans %}
{% blocktrans %}Are you sure you want to delete this?{% endblocktrans %}
{% endif %}
</p>
<div class="buttons">

View File

@ -0,0 +1,19 @@
{% extends "chrono/manager_home.html" %}
{% load i18n %}
{% block appbar %}
<h2>{{ object }}</h2>
{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
<p>
{% blocktrans %}Are you sure you want to delete this exception?{% endblocktrans %}
</p>
<div class="buttons">
<button class="delete-button" {% if cannot_delete %}disabled="disabled"{% endif %}>{% trans 'Delete' %}</button>
<a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
</div>
</form>
{% endblock %}

View File

@ -782,7 +782,7 @@ time_period_exception_extract_list = TimePeriodExceptionExtractListView.as_view(
class TimePeriodExceptionDeleteView(ManagedDeskSubobjectMixin, DeleteView):
template_name = 'chrono/manager_confirm_delete.html'
template_name = 'chrono/manager_confirm_exception_delete.html'
model = TimePeriodException
def get_success_url(self):

View File

@ -250,7 +250,7 @@ def test_delete_busy_agenda(app, admin_user):
resp = app.get('/manage/', status=200)
resp = resp.click('Foo bar').follow()
resp = resp.click('Delete')
assert 'Are you sure you want to delete this exception?' in resp.text
assert 'Are you sure you want to delete this?' in resp.text
booking = Booking(event=event)
booking.save()
@ -264,7 +264,7 @@ def test_delete_busy_agenda(app, admin_user):
resp = app.get('/manage/', status=200)
resp = resp.click('Foo bar').follow()
resp = resp.click('Delete')
assert 'Are you sure you want to delete this exception?' in resp.text
assert 'Are you sure you want to delete this?' in resp.text
# suddenly the booking is no longer cancelled, but the admin clicks on the
# delete button.
@ -300,7 +300,7 @@ def test_delete_busy_desk(app, admin_user):
resp = resp.click('Settings')
desk_page = resp.click('Desk A')
desk_delete_page = desk_page.click('Delete')
assert 'Are you sure you want to delete this exception?' in desk_delete_page.text
assert 'Are you sure you want to delete this?' in desk_delete_page.text
# make sure the deleting is not disabled
assert 'disabled' not in desk_delete_page.text
@ -489,7 +489,7 @@ def test_delete_busy_event(app, admin_user):
resp = app.get('/manage/agendas/%s/settings' % agenda.id, status=200)
resp = resp.click(href=r'/manage/events/%s/$' % event.id)
resp = resp.click('Delete')
assert 'Are you sure you want to delete this exception?' in resp.text
assert 'Are you sure you want to delete this?' in resp.text
booking = Booking(event=event)
booking.save()
@ -503,7 +503,7 @@ def test_delete_busy_event(app, admin_user):
resp = app.get('/manage/agendas/%s/settings' % agenda.id, status=200)
resp = resp.click(href=r'/manage/events/%s/$' % event.id)
resp = resp.click('Delete')
assert 'Are you sure you want to delete this exception?' in resp.text
assert 'Are you sure you want to delete this?' in resp.text
# suddenly the booking is no longer cancelled, but the admin clicks on the
# delete button.