diff --git a/app/main/views/templates.py b/app/main/views/templates.py index e42aba388..a3827a4b5 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -1,4 +1,5 @@ from datetime import datetime, timedelta +from functools import partial from string import ascii_uppercase from dateutil.parser import parse @@ -406,25 +407,32 @@ def _get_template_copy_name(template, existing_templates): @main.route(( '/services//templates/action-blocked/' - '' + '/' )) @main.route(( '/services//templates/action-blocked/' '//' )) @user_has_permissions('manage_templates') -def action_blocked(service_id, notification_type, return_to='add_new_template', template_id=None): - if notification_type == 'sms': - notification_type = 'text messages' - elif notification_type == 'email': - notification_type = 'emails' +def action_blocked(service_id, notification_type, return_to, template_id=None): + + back_link = { + 'add_new_template': partial( + url_for, '.choose_template', service_id=current_service.id + ), + 'templates': partial( + url_for, '.choose_template', service_id=current_service.id + ), + 'view_template': partial( + url_for, '.view_template', service_id=current_service.id, template_id=template_id + ), + }.get(return_to) return render_template( 'views/templates/action_blocked.html', service_id=service_id, notification_type=notification_type, - return_to=return_to, - template_id=template_id, + back_link=back_link(), ) diff --git a/app/templates/views/templates/action_blocked.html b/app/templates/views/templates/action_blocked.html index d7575fe41..84bb59b8e 100644 --- a/app/templates/views/templates/action_blocked.html +++ b/app/templates/views/templates/action_blocked.html @@ -2,6 +2,7 @@ {% from "components/textbox.html" import textbox %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} +{% from "components/message-count-label.html" import message_count_label %} {% block service_page_title %} {{ notification_type.capitalize() }} are disabled @@ -11,26 +12,15 @@
- {% set - back_link_dict = { - 'add_new_template': '.choose_template', - 'templates': '.choose_template', - 'view_template': '.view_template' - } - %} {{ page_header( '{} are disabled'.format(notification_type.capitalize()), - back_link=url_for( - back_link_dict[return_to], - service_id=current_service.id, - template_id=template_id - ) + back_link=back_link, ) }}

- Sending {{ notification_type }} has been disabled for your service. + Sending {{ message_count_label(999, notification_type, suffix='') -}} has been disabled for your service.

- If you need to send {{ notification_type }} + If you need to send {{ message_count_label(999, notification_type, suffix='') }} get in touch with the GOV.UK Notify team.