From f5807d939a433fdb6d6146da715b2334bcbed635 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 5 Feb 2016 09:55:27 +0000 Subject: [PATCH 1/4] Add secondary link pattern to page footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit brings back the ‘link under the green button’ bit of the page footer component. Previous it had been changed to be a grey button. But there are use cases for both, maybe even simultaneously. --- app/assets/stylesheets/components/page-footer.scss | 4 ++++ app/templates/components/page-footer.html | 5 +++++ app/templates/views/styleguide.html | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/app/assets/stylesheets/components/page-footer.scss b/app/assets/stylesheets/components/page-footer.scss index 4aea437c4..2a5e07613 100644 --- a/app/assets/stylesheets/components/page-footer.scss +++ b/app/assets/stylesheets/components/page-footer.scss @@ -28,6 +28,10 @@ } + &-secondary-link { + display: block; + margin-top: $gutter; + } .button {} diff --git a/app/templates/components/page-footer.html b/app/templates/components/page-footer.html index 1ea1dae64..7c0153d58 100644 --- a/app/templates/components/page-footer.html +++ b/app/templates/components/page-footer.html @@ -3,6 +3,8 @@ destructive=False, back_link=False, back_link_text="Back", + secondary_link=False, + secondary_link_text=None, delete_link=False, delete_link_text="delete" ) %} @@ -19,5 +21,8 @@ {% if back_link %} {{ back_link_text }} {% endif %} + {% if secondary_link and secondary_link_text %} + {{ secondary_link_text }} + {% endif %} {% endmacro %} diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index a27dbe7f9..6455a0ff5 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -117,6 +117,10 @@ button_text='Send', back_link='http://example.com', back_link_text="Back to dashboard" ) }} + {{ page_footer( + button_text='Sign in', secondary_link='http://example.com', secondary_link_text="I’ve forgotten my password" + ) }} +

SMS message

Used to show, preview or choose an SMS message.

From 0fc927b4584b4a47a03ae2c3a8848210c8cb0685 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 5 Feb 2016 10:24:43 +0000 Subject: [PATCH 2/4] Review usage of secondary/back links This commit examines all the pages that use the page footer component, and determines whether they should have a back button, a secondary link, both or neither. --- app/templates/views/api-keys/create.html | 6 +----- app/templates/views/api-keys/show.html | 4 ++-- app/templates/views/edit-template.html | 4 ++-- app/templates/views/notification.html | 4 ++-- app/templates/views/service-settings/name.html | 3 ++- .../views/service-settings/request-to-go-live.html | 3 ++- app/templates/views/service-settings/status.html | 5 +++-- app/templates/views/signin.html | 2 +- app/templates/views/user-profile/change-password.html | 4 ++-- tests/app/main/views/test_service_settings.py | 2 +- 10 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/templates/views/api-keys/create.html b/app/templates/views/api-keys/create.html index 01c4b59ad..4791ece27 100644 --- a/app/templates/views/api-keys/create.html +++ b/app/templates/views/api-keys/create.html @@ -14,11 +14,7 @@
{{ textbox(key_name, hint='eg CRM application') }} - {{ page_footer( - 'Continue', - back_link=url_for('.api_keys', service_id=service_id), - back_link_text='Back to API keys' - ) }} + {{ page_footer('Continue') }}
{% endblock %} diff --git a/app/templates/views/api-keys/show.html b/app/templates/views/api-keys/show.html index 13f451339..1ba6a4d55 100644 --- a/app/templates/views/api-keys/show.html +++ b/app/templates/views/api-keys/show.html @@ -26,8 +26,8 @@ {{ page_footer( - back_link=url_for('.api_keys', service_id=service_id), - back_link_text='Back to API keys' + secondary_link=url_for('.api_keys', service_id=service_id), + secondary_link_text='Back to API keys' ) }} {% endblock %} diff --git a/app/templates/views/edit-template.html b/app/templates/views/edit-template.html index f2776751c..c591acacb 100644 --- a/app/templates/views/edit-template.html +++ b/app/templates/views/edit-template.html @@ -26,8 +26,8 @@ GOV.UK Notify | Edit template 'Save', delete_link=url_for('.delete_service_template', service_id=service_id, template_id=template_id) if template_id or None, delete_link_text='delete this template', - back_link=url_for('.manage_service_templates', service_id=service_id), - back_link_text='Back to templates' + secondary_link=url_for('.manage_service_templates', service_id=service_id), + secondary_link_text='Back to templates' ) }} diff --git a/app/templates/views/notification.html b/app/templates/views/notification.html index 78da91d3d..3303885a5 100644 --- a/app/templates/views/notification.html +++ b/app/templates/views/notification.html @@ -26,8 +26,8 @@ GOV.UK Notify | Notifications activity {{ page_footer( - back_link = url_for('.view_job', service_id=service_id, job_id=job_id), - back_link_text = 'View other messages in this job' + secondary_link = url_for('.view_job', service_id=service_id, job_id=job_id), + secondary_link_text = 'View other messages in this job' ) }} {% endblock %} diff --git a/app/templates/views/service-settings/name.html b/app/templates/views/service-settings/name.html index 67f87b619..f28988794 100644 --- a/app/templates/views/service-settings/name.html +++ b/app/templates/views/service-settings/name.html @@ -24,7 +24,8 @@ GOV.UK Notify | Service settings {{ textbox(form.name) }} {{ page_footer( 'Save', - back_link=url_for('.service_settings', service_id=service_id) + back_link=url_for('.service_settings', service_id=service_id), + back_link_text='Back to settings' ) }} diff --git a/app/templates/views/service-settings/request-to-go-live.html b/app/templates/views/service-settings/request-to-go-live.html index 104a84052..a4805e95e 100644 --- a/app/templates/views/service-settings/request-to-go-live.html +++ b/app/templates/views/service-settings/request-to-go-live.html @@ -39,7 +39,8 @@
{{ page_footer( 'Send request', - back_link=url_for('.service_settings', service_id=service_id) + back_link=url_for('.service_settings', service_id=service_id), + back_link_text='Back to settings' ) }}
diff --git a/app/templates/views/service-settings/status.html b/app/templates/views/service-settings/status.html index ba5ef5421..384c67636 100644 --- a/app/templates/views/service-settings/status.html +++ b/app/templates/views/service-settings/status.html @@ -23,9 +23,10 @@ GOV.UK Notify | Service settings
{{ page_footer( - 'Turn off all outgoing notifications', + 'Suspend API keys', destructive=True, - back_link=url_for('.service_settings', service_id=service_id) + back_link=url_for('.service_settings', service_id=service_id), + back_link_text='Back to settings' ) }}
diff --git a/app/templates/views/signin.html b/app/templates/views/signin.html index 845edeb29..e886e673e 100644 --- a/app/templates/views/signin.html +++ b/app/templates/views/signin.html @@ -17,7 +17,7 @@ Sign in
{{ textbox(form.email_address) }} {{ textbox(form.password) }} - {{ page_footer("Continue", back_link=url_for('.forgot_password'), back_link_text="Forgotten password?") }} + {{ page_footer("Continue", secondary_link=url_for('.forgot_password'), secondary_link_text="Forgotten password?") }}
diff --git a/app/templates/views/user-profile/change-password.html b/app/templates/views/user-profile/change-password.html index 3669dd10c..52058e0c2 100644 --- a/app/templates/views/user-profile/change-password.html +++ b/app/templates/views/user-profile/change-password.html @@ -17,8 +17,8 @@ GOV.UK Notify | Service settings {{ textbox(form.new_password) }} {{ page_footer( 'Save', - back_link=url_for('.user_profile'), - back_link_text="Back to your profile" + secondary_link=url_for('.user_profile'), + secondary_link_text="Back to your profile" ) }} diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 0f87134fd..045cc4c86 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -161,7 +161,7 @@ def test_should_show_status_page(app_, assert response.status_code == 200 resp_data = response.get_data(as_text=True) - assert 'Turn off all outgoing notifications' in resp_data + assert 'Suspend API keys' in resp_data assert mock_get_service.called From 9c1e47d59436e9c9d707e221cd1bf3e607f3e4de Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 5 Feb 2016 10:25:49 +0000 Subject: [PATCH 3/4] Fix wrapping of API key --- app/templates/views/api-keys/show.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/views/api-keys/show.html b/app/templates/views/api-keys/show.html index 1ba6a4d55..55357ec5f 100644 --- a/app/templates/views/api-keys/show.html +++ b/app/templates/views/api-keys/show.html @@ -20,11 +20,11 @@ once you leave this page.

- {{ api_key(secret, key_name) }} - + {{ api_key(secret, key_name) }} + {{ page_footer( secondary_link=url_for('.api_keys', service_id=service_id), secondary_link_text='Back to API keys' From 7dc5d76b98ba1fcdb469c66385ee04f10fb8a4e5 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 5 Feb 2016 10:33:14 +0000 Subject: [PATCH 4/4] Use banners appropriately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’ve fiddled around with the banners quite a lot in the last few days. This commit reviews some of the older examples and makes sure that they’re: a) not broken b) using the most appropriate banner for the context --- app/main/views/api_keys.py | 2 +- app/templates/flash_messages.html | 2 +- app/templates/views/api-keys.html | 7 ++++--- app/templates/views/styleguide.html | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index 1a0492351..36959a86d 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -51,5 +51,5 @@ def revoke_api_key(service_id, key_id): ) elif request.method == 'POST': api_key_api_client.revoke_api_key(service_id=service_id, key_id=key_id) - flash('‘{}’ was revoked'.format(key_name), 'default') + flash('‘{}’ was revoked'.format(key_name), 'default_with_tick') return redirect(url_for('.api_keys', service_id=service_id)) diff --git a/app/templates/flash_messages.html b/app/templates/flash_messages.html index 85be2d13d..ec2b1a5d0 100644 --- a/app/templates/flash_messages.html +++ b/app/templates/flash_messages.html @@ -4,7 +4,7 @@ {% for category, message in messages %} {{ banner( message, - 'default' if category == 'default' or 'default_with_tick' else 'dangerous', + 'default' if ((category == 'default') or (category == 'default_with_tick')) else 'dangerous', delete_button="Yes, delete this template" if 'delete' == category else None, with_tick=True if category == 'default_with_tick' else False )}} diff --git a/app/templates/views/api-keys.html b/app/templates/views/api-keys.html index a08dcef86..3884d35db 100644 --- a/app/templates/views/api-keys.html +++ b/app/templates/views/api-keys.html @@ -23,9 +23,10 @@

{{ banner( - 'You can only send notifications to yourself', - subhead='Trial mode', - type='info' + 'You can only send messages to yourself until you request to go live'.format( + url_for('.service_request_to_go_live', service_id=service_id) + )|safe, + type='important' ) }}

diff --git a/app/templates/views/styleguide.html b/app/templates/views/styleguide.html index 6455a0ff5..da99a5d9a 100644 --- a/app/templates/views/styleguide.html +++ b/app/templates/views/styleguide.html @@ -51,6 +51,8 @@ type='tip' )}} + {{ banner('You could go to jail', 'important')}} +

Big number

Used to show some important statistics.