From 04160800f0924d435c5af94f85839dbe7a4f72be Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Wed, 19 Aug 2020 21:35:05 +0100 Subject: [PATCH] Update call to `api_key` component across pages Includes the following pages: - letter contact (in service settings) - sms-senders page (in service settings) - email reply-to (in service settings) - API key page Note: the call on the letter contact page uses the first line of the contact address as the unique identifier for each button. --- app/__init__.py | 1 + app/templates/views/api/keys/show.html | 3 ++- app/templates/views/service-settings/email_reply_to.html | 2 +- .../views/service-settings/letter-contact-details.html | 3 ++- app/templates/views/service-settings/sms-senders.html | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 1bae233cd..19d889744 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -807,6 +807,7 @@ def add_template_filters(application): format_notification_status_as_url, format_number_in_pounds_as_currency, formatters.formatted_list, + formatters.normalise_lines, nl2br, format_phone_number_human_readable, format_thousands, diff --git a/app/templates/views/api/keys/show.html b/app/templates/views/api/keys/show.html index f9012afff..44765a387 100644 --- a/app/templates/views/api/keys/show.html +++ b/app/templates/views/api/keys/show.html @@ -24,7 +24,8 @@ {{ api_key( '{}-{}-{}'.format(key_name, service_id, secret), - 'API key' + name='API key', + thing='API key' ) }} {{ page_footer( diff --git a/app/templates/views/service-settings/email_reply_to.html b/app/templates/views/service-settings/email_reply_to.html index 201ef3013..60c88d6bb 100644 --- a/app/templates/views/service-settings/email_reply_to.html +++ b/app/templates/views/service-settings/email_reply_to.html @@ -34,7 +34,7 @@ Change {% endif %} {% if current_service.count_email_reply_to_addresses > 1 %} - {{ api_key(item.id, item.email_address, thing="ID", heading=False) }} + {{ api_key(item.id, name=item.email_address, thing="ID") }} {% endif %} {% endfor %} diff --git a/app/templates/views/service-settings/letter-contact-details.html b/app/templates/views/service-settings/letter-contact-details.html index 08f32436b..0cf921156 100644 --- a/app/templates/views/service-settings/letter-contact-details.html +++ b/app/templates/views/service-settings/letter-contact-details.html @@ -43,7 +43,8 @@ Change {% endif %} {% if letter_contact_details|length > 1 %} - {{ api_key(item.id, thing="ID") }} + {% set first_line_of_contact_block = item.contact_block|normalise_lines|first %} + {{ api_key(item.id, name=first_line_of_contact_block, thing="ID") }} {% endif %} {% endfor %} diff --git a/app/templates/views/service-settings/sms-senders.html b/app/templates/views/service-settings/sms-senders.html index 097a254de..aa7d9806f 100644 --- a/app/templates/views/service-settings/sms-senders.html +++ b/app/templates/views/service-settings/sms-senders.html @@ -36,7 +36,7 @@ Change {% endif %} {% if current_service.count_sms_senders > 1 %} - {{ api_key(item.id, thing="ID") }} + {{ api_key(item.id, name=item.sms_sender, thing="ID") }} {% endif %} {% endfor %}