From b895be3826d75033f4a611232554956d9df8732b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Tue, 5 Nov 2024 11:03:40 +0100 Subject: [PATCH] Add a back button to select_financial_annex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the cancel button that’s usually used for multi-step forms with a simple back button at the top of the page. --- itou/templates/companies/select_financial_annex.html | 7 +++++-- itou/templates/utils/templatetags/buttons_form.html | 6 ++++-- itou/www/companies_views/views.py | 5 ++++- tests/utils/__snapshots__/test_templatetags.ambr | 12 +++++++++--- .../approvals_views/__snapshots__/test_suspend.ambr | 4 +++- .../__snapshots__/test_add.ambr | 4 +++- .../__snapshots__/test_create.ambr | 4 +++- 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/itou/templates/companies/select_financial_annex.html b/itou/templates/companies/select_financial_annex.html index 20f3f3ee87..ef8c4bbe76 100644 --- a/itou/templates/companies/select_financial_annex.html +++ b/itou/templates/companies/select_financial_annex.html @@ -2,6 +2,10 @@ {% load django_bootstrap5 %} {% load buttons_form %} +{% block title_prevstep %} + {% include "layout/previous_step.html" with back_url=back_url only %} +{% endblock %} + {% block title %}Sélectionner une annexe financière {{ block.super }}{% endblock %} {% block title_content %}

Sélectionner une annexe financière

{% endblock %} @@ -20,8 +24,7 @@ {% bootstrap_field select_form.financial_annexes %} - {% itou_buttons_form primary_label="Continuer" %} - + {% itou_buttons_form primary_label="Continuer" reset_url=None %} diff --git a/itou/templates/utils/templatetags/buttons_form.html b/itou/templates/utils/templatetags/buttons_form.html index f9beee0e2d..c8c3ff293a 100644 --- a/itou/templates/utils/templatetags/buttons_form.html +++ b/itou/templates/utils/templatetags/buttons_form.html @@ -12,7 +12,7 @@ Annuler - {% else %} + {% elif reset_url is not None %} Annuler @@ -72,7 +72,9 @@ diff --git a/itou/www/companies_views/views.py b/itou/www/companies_views/views.py index 2ba2be1a5d..c1b3dfdd54 100644 --- a/itou/www/companies_views/views.py +++ b/itou/www/companies_views/views.py @@ -435,7 +435,10 @@ def select_financial_annex(request, template_name="companies/select_financial_an messages.success(request, message) return HttpResponseRedirect(reverse("companies_views:show_financial_annexes")) - context = {"select_form": select_form} + context = { + "select_form": select_form, + "back_url": reverse("companies_views:show_financial_annexes"), + } return render(request, template_name, context) diff --git a/tests/utils/__snapshots__/test_templatetags.ambr b/tests/utils/__snapshots__/test_templatetags.ambr index c2d59486d4..0305606f3c 100644 --- a/tests/utils/__snapshots__/test_templatetags.ambr +++ b/tests/utils/__snapshots__/test_templatetags.ambr @@ -420,7 +420,9 @@ @@ -485,7 +487,9 @@ @@ -550,7 +554,9 @@ diff --git a/tests/www/approvals_views/__snapshots__/test_suspend.ambr b/tests/www/approvals_views/__snapshots__/test_suspend.ambr index f23b150239..cdbbba0e61 100644 --- a/tests/www/approvals_views/__snapshots__/test_suspend.ambr +++ b/tests/www/approvals_views/__snapshots__/test_suspend.ambr @@ -902,7 +902,9 @@ diff --git a/tests/www/employee_record_views/__snapshots__/test_add.ambr b/tests/www/employee_record_views/__snapshots__/test_add.ambr index e6fa7424f7..02f51e4789 100644 --- a/tests/www/employee_record_views/__snapshots__/test_add.ambr +++ b/tests/www/employee_record_views/__snapshots__/test_add.ambr @@ -101,7 +101,9 @@ diff --git a/tests/www/employee_record_views/__snapshots__/test_create.ambr b/tests/www/employee_record_views/__snapshots__/test_create.ambr index a7da43b74d..a7ee738e8c 100644 --- a/tests/www/employee_record_views/__snapshots__/test_create.ambr +++ b/tests/www/employee_record_views/__snapshots__/test_create.ambr @@ -328,7 +328,9 @@