Skip to content

Commit

Permalink
Add a back button to select_financial_annex
Browse files Browse the repository at this point in the history
Replace the cancel button that’s usually used for multi-step forms with
a simple back button at the top of the page.
  • Loading branch information
francoisfreitag committed Nov 18, 2024
1 parent 3f7f8ec commit b895be3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
7 changes: 5 additions & 2 deletions itou/templates/companies/select_financial_annex.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}<h1>Sélectionner une annexe financière</h1>{% endblock %}
Expand All @@ -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 %}
</form>
</div>

Expand Down
6 changes: 4 additions & 2 deletions itou/templates/utils/templatetags/buttons_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<i class="ri-close-line ri-lg" aria-hidden="true"></i>
<span>Annuler</span>
</button>
{% else %}
{% elif reset_url is not None %}
<a href="{{ reset_url }}" class="btn btn-link btn-ico ps-lg-0 w-100 w-lg-auto" aria-label="Annuler la saisie de ce formulaire">
<i class="ri-close-line ri-lg" aria-hidden="true"></i>
<span>Annuler</span>
Expand Down Expand Up @@ -72,7 +72,9 @@ <h3 class="modal-title">Êtes-vous sûr de vouloir annuler ?</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal">Retour</button>
<a href="{{ reset_url }}" class="btn btn-sm btn-danger">Confirmer l'annulation</a>
{% if reset_url is not None %}
<a href="{{ reset_url }}" class="btn btn-sm btn-danger">Confirmer l'annulation</a>
{% endif %}
</div>
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion itou/www/companies_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
12 changes: 9 additions & 3 deletions tests/utils/__snapshots__/test_templatetags.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal">Retour</button>
<a href="/dashboard/" class="btn btn-sm btn-danger">Confirmer l'annulation</a>

<a href="/dashboard/" class="btn btn-sm btn-danger">Confirmer l'annulation</a>

</div>
</div>
</div>
Expand Down Expand Up @@ -485,7 +487,9 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal">Retour</button>
<a href="/dashboard/" class="btn btn-sm btn-danger">Confirmer l'annulation</a>

<a href="/dashboard/" class="btn btn-sm btn-danger">Confirmer l'annulation</a>

</div>
</div>
</div>
Expand Down Expand Up @@ -550,7 +554,9 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal">Retour</button>
<a href="/dashboard/" class="btn btn-sm btn-danger">Confirmer l'annulation</a>

<a href="/dashboard/" class="btn btn-sm btn-danger">Confirmer l'annulation</a>

</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion tests/www/approvals_views/__snapshots__/test_suspend.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,9 @@
</div>
<div class="modal-footer">
<button class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal" type="button">Retour</button>
<a class="btn btn-sm btn-danger" href="/search/employers">Confirmer l'annulation</a>

<a class="btn btn-sm btn-danger" href="/search/employers">Confirmer l'annulation</a>

</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion tests/www/employee_record_views/__snapshots__/test_add.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@
</div>
<div class="modal-footer">
<button class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal" type="button">Retour</button>
<a class="btn btn-sm btn-danger" href="/employee_record/list?status=NEW">Confirmer l'annulation</a>

<a class="btn btn-sm btn-danger" href="/employee_record/list?status=NEW">Confirmer l'annulation</a>

</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@
</div>
<div class="modal-footer">
<button class="btn btn-sm btn-outline-primary" data-bs-dismiss="modal" type="button">Retour</button>
<a class="btn btn-sm btn-danger" href="/employee_record/list">Confirmer l'annulation</a>

<a class="btn btn-sm btn-danger" href="/employee_record/list">Confirmer l'annulation</a>

</div>
</div>
</div>
Expand Down

0 comments on commit b895be3

Please sign in to comment.