From 670d82b72ce4a50e918033170388f1ef23cf24da Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Fri, 25 Apr 2025 10:23:28 -0400 Subject: [PATCH] Adjusting back text for all steps in send message process --- app/main/views/send.py | 61 +++++++++++++------- app/templates/views/check/ok.html | 2 +- app/templates/views/edit-sms-template.html | 3 +- app/templates/views/notifications/check.html | 2 +- app/templates/views/send-test.html | 2 +- app/templates/views/send.html | 5 +- 6 files changed, 50 insertions(+), 25 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index e3b3ed0a9..ab5a4c6dc 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -476,7 +476,7 @@ def send_one_off_step(service_id, template_id, step_index): "views/send-test.html", page_title=get_send_test_page_title( template.template_type, - entering_recipient=not session["recipient"], + entering_recipient=(step_index == 0), name=template.name, ), template=template, @@ -755,31 +755,52 @@ def get_back_link( preview=False, ): if preview: - return url_for( - "main.check_notification", - service_id=service_id, - template_id=template.id, - ) + return { + "href": { + "url": url_for( + "main.check_notification", + service_id=service_id, + template_id=template.id, + ), + "text": "Back to preview" + }, + "html": "Back to preview" + } if step_index == 0: if should_skip_template_page(template._template): - return url_for( - ".choose_template", - service_id=service_id, - ) + return { + "href": { + "url": url_for(".choose_template", service_id=service_id), + "text": "Back to all templates" + }, + "html": "Back to all templates" + } else: - return url_for( - ".view_template", + return { + "href": { + "url": url_for(".view_template", service_id=service_id, template_id=template.id), + "text": "Back to confirm your template" + }, + "html": "Back to confirm your template" + } + + back_to_text = ( + "Back to select recipients" if step_index == 1 else "Back to message personalization" + ) + + return { + "href": { + "url": url_for( + "main.send_one_off_step", service_id=service_id, template_id=template.id, - ) - - return url_for( - "main.send_one_off_step", - service_id=service_id, - template_id=template.id, - step_index=step_index - 1, - ) + step_index=step_index - 1, + ), + "text": back_to_text + }, + "html": back_to_text + } def get_skip_link(step_index, template): diff --git a/app/templates/views/check/ok.html b/app/templates/views/check/ok.html index 71324b724..02c903d0e 100644 --- a/app/templates/views/check/ok.html +++ b/app/templates/views/check/ok.html @@ -12,7 +12,7 @@ {% block backLink %} - {{ usaBackLink({ "href": back_link }) }} + {{ usaBackLink(back_link) }} {% endblock %} {% block maincolumn_content %} diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index 87dba61e4..8dc8448a1 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -11,7 +11,8 @@ {% block backLink %} {{ usaBackLink({ - "href": url_for('main.choose_template', service_id=current_service.id, template_folder_id=template_folder_id) if template_folder_id else url_for('main.choose_template', service_id=current_service.id) + "href": url_for('main.choose_template', service_id=current_service.id, template_folder_id=template_folder_id) if template_folder_id else url_for('main.choose_template', service_id=current_service.id), + "html": "Back to all templates" }) }} {% endblock %} diff --git a/app/templates/views/notifications/check.html b/app/templates/views/notifications/check.html index 8646d1b7f..6566c395c 100644 --- a/app/templates/views/notifications/check.html +++ b/app/templates/views/notifications/check.html @@ -9,7 +9,7 @@ {% endblock %} {% block backLink %} - {{ usaBackLink({ "href": back_link }) }} + {{ usaBackLink(back_link) }} {% endblock %} {% block maincolumn_content %} diff --git a/app/templates/views/send-test.html b/app/templates/views/send-test.html index 3f1161f6b..2dc94efb7 100644 --- a/app/templates/views/send-test.html +++ b/app/templates/views/send-test.html @@ -9,7 +9,7 @@ {% endblock %} {% block backLink %} - {{ usaBackLink({ "href": back_link }) }} + {{ usaBackLink(back_link) }} {% endblock %} diff --git a/app/templates/views/send.html b/app/templates/views/send.html index 219c16cc8..2250b5199 100644 --- a/app/templates/views/send.html +++ b/app/templates/views/send.html @@ -12,7 +12,10 @@ {% block backLink %} - {{ usaBackLink(params) }} + {{ usaBackLink({ + "href": url_for('main.send_one_off_step', service_id=current_service.id, template_id=template.id, step_index=0), + "html": "Back to select recipients" + }) }} {% endblock %} {% set phone_numbers = [