From 562fc4e73c5fa496cafa317a949a5b8ccbe0778f Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 11 Mar 2016 07:30:40 +0000 Subject: [PATCH 1/5] =?UTF-8?q?Remove=20=E2=80=98cancel=E2=80=99=20links?= =?UTF-8?q?=20from=20edit=20template=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since cancel just takes you back to the list of templates, which is accessible from the left nav, it’s only adding clutter to the page. --- app/templates/views/edit-email-template.html | 4 +--- app/templates/views/edit-sms-template.html | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/templates/views/edit-email-template.html b/app/templates/views/edit-email-template.html index 3f9ec239f..fa16b07c9 100644 --- a/app/templates/views/edit-email-template.html +++ b/app/templates/views/edit-email-template.html @@ -29,9 +29,7 @@ {{ page_footer( '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('.choose_template', template_type=template_type, service_id=service_id), - back_link_text='Cancel' + delete_link_text='Delete this template' ) }} diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index b8b44a927..5f57dd61f 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -28,9 +28,7 @@ {{ page_footer( '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('.choose_template', service_id=service_id, template_type=template_type), - back_link_text='Cancel' + delete_link_text='Delete this template' ) }} From b4e6f734c8d51c15e89c071c7d5eb610c69d1e98 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 11 Mar 2016 07:38:35 +0000 Subject: [PATCH 2/5] Reword the help text about adding placeholders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In research we’ve seen users struggle with this. Often they’d type ((Joe Bloggs)) or ((XX/XX/XXXX)) instead of a sensible name. Lets see if explaining it differently helps. --- app/assets/stylesheets/views/edit-template.scss | 2 +- app/templates/views/edit-email-template.html | 8 ++++++-- app/templates/views/edit-sms-template.html | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/views/edit-template.scss b/app/assets/stylesheets/views/edit-template.scss index 3635b067f..dd1c8e789 100644 --- a/app/assets/stylesheets/views/edit-template.scss +++ b/app/assets/stylesheets/views/edit-template.scss @@ -3,7 +3,7 @@ &-placeholder-hint { display: block; padding-top: 20px; - color: $secondary-text-colour; + //color: $secondary-text-colour; } } diff --git a/app/templates/views/edit-email-template.html b/app/templates/views/edit-email-template.html index fa16b07c9..2a41722e3 100644 --- a/app/templates/views/edit-email-template.html +++ b/app/templates/views/edit-email-template.html @@ -21,8 +21,12 @@
diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index 5f57dd61f..f4a395928 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -20,8 +20,12 @@
From 370fd68a2cd50dad5520119be614b36b513a9371 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 11 Mar 2016 07:45:10 +0000 Subject: [PATCH 3/5] Fix innaccurate headings on add/edit template page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same `.html` file is shared between adding a template and editing a template. The page heading needs to be contextual to the URL, either ‘add’ or ‘edit’. Somewhere along the way this got lost; this commit reinstates it. --- app/main/views/templates.py | 11 +++++++++-- app/templates/views/edit-email-template.html | 6 ++++-- app/templates/views/edit-sms-template.html | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 0b7119e9d..f390ff9af 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -13,6 +13,11 @@ form_objects = { 'sms': SMSTemplateForm } +page_headings = { + 'email': 'email', + 'sms': 'text message' +} + @main.route("/services//templates/add-", methods=['GET', 'POST']) @login_required @@ -42,7 +47,8 @@ def add_service_template(service_id, template_type): 'views/edit-{}-template.html'.format(template_type), form=form, template_type=template_type, - service_id=service_id + service_id=service_id, + heading_action='Add' ) @@ -70,7 +76,8 @@ def edit_service_template(service_id, template_id): form=form, service_id=service_id, template_id=template_id, - template_type=template['template_type'] + template_type=template['template_type'], + heading_action='Edit' ) diff --git a/app/templates/views/edit-email-template.html b/app/templates/views/edit-email-template.html index 2a41722e3..0505fc97c 100644 --- a/app/templates/views/edit-email-template.html +++ b/app/templates/views/edit-email-template.html @@ -3,12 +3,14 @@ {% from "components/page-footer.html" import page_footer %} {% block page_title %} - {{ h1 }} – GOV.UK Notify + {{ heading_action }} email template – GOV.UK Notify {% endblock %} {% block maincolumn_content %} -

Edit email template

+

+ {{ heading_action }} email template +

diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index f4a395928..a571c300a 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -3,12 +3,14 @@ {% from "components/page-footer.html" import page_footer %} {% block page_title %} - {{ h1 }} – GOV.UK Notify + {{ heading_action }} text message template – GOV.UK Notify {% endblock %} {% block maincolumn_content %} -

Edit text message template

+

+ {{ heading_action }} text message template +

From eea8ae5be484faeef8a2a521f12139dd814fbfa3 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 11 Mar 2016 07:47:46 +0000 Subject: [PATCH 4/5] =?UTF-8?q?Move=20=E2=80=98new=20thing=E2=80=99=20butt?= =?UTF-8?q?ons=20alongside=20heading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the send messages and manage team pages we have big green buttons for adding/inviting a new template or team member. On the add template page it was at the bottom, and often got missed. On the manage team page it was at the top, but maybe too prominent because it’s big and green. This commit tries putting it in the top right of the page instead (except when the template page is empty, in which case it’s unchanged). --- app/assets/stylesheets/_grids.scss | 9 +- app/templates/views/choose-template.html | 101 ++++++++++++---------- app/templates/views/invite-user.html | 2 +- app/templates/views/manage-users.html | 15 ++-- app/templates/views/service-settings.html | 2 +- tests/app/main/views/test_manage_users.py | 4 +- 6 files changed, 77 insertions(+), 56 deletions(-) diff --git a/app/assets/stylesheets/_grids.scss b/app/assets/stylesheets/_grids.scss index 5e8643173..490f4d01d 100644 --- a/app/assets/stylesheets/_grids.scss +++ b/app/assets/stylesheets/_grids.scss @@ -2,7 +2,6 @@ @include grid-column(3/4); } - .column-one-eighth { @include grid-column(1/8); } @@ -19,3 +18,11 @@ .bottom-gutter-2-3 { margin-bottom: $gutter * 2/3; } + +.align-with-heading { + display: block; + text-align: center; + margin-top: 45px; + padding-left: 2px; + padding-right: 2px; +} diff --git a/app/templates/views/choose-template.html b/app/templates/views/choose-template.html index 00b4cbc2f..e3d11ed02 100644 --- a/app/templates/views/choose-template.html +++ b/app/templates/views/choose-template.html @@ -10,55 +10,64 @@ {% block maincolumn_content %} -

{{ page_heading }}

+ {% if not templates %} - +

{{ page_heading }}

- {% if templates %} - {% if not has_jobs %} - {% if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], or_=True) %} - {{ banner( - """ - Send yourself a test message - """, - subhead='Next step', - type="tip" - )}} - {% endif %} - {% endif %} -
- {% for template in templates %} -
- {% if 'email' == template_type %} - {{ email_message( - template.subject, - template.formatted_as_markup, - name=template.name - ) }} - {% elif 'sms' == template_type %} - {{ sms_message(template.formatted_as_markup, name=template.name) }} - {% endif %} -
-
- -
- {% endfor %} -
+ {% if current_user.has_permissions(['manage_templates']) %} + Add a new template {% endif %} -

- {% if current_user.has_permissions(['manage_templates']) %} - Add a new template - {% endif %} -

+ {% else %} + +
+
+

{{ page_heading }}

+
+ {% if current_user.has_permissions(['manage_templates']) %} + + {% endif %} +
+ + {% if not has_jobs %} + {% if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], or_=True) %} + {{ banner( + """ + Send yourself a test message + """, + subhead='Next step', + type="tip" + )}} + {% endif %} + {% endif %} +
+ {% for template in templates %} +
+ {% if 'email' == template_type %} + {{ email_message( + template.subject, + template.formatted_as_markup, + name=template.name + ) }} + {% elif 'sms' == template_type %} + {{ sms_message(template.formatted_as_markup, name=template.name) }} + {% endif %} +
+
+ +
+ {% endfor %} +
+ {% endif %} - {% endblock %} diff --git a/app/templates/views/invite-user.html b/app/templates/views/invite-user.html index d4fcf104f..b50b9d663 100644 --- a/app/templates/views/invite-user.html +++ b/app/templates/views/invite-user.html @@ -10,7 +10,7 @@ Manage users – GOV.UK Notify {% block maincolumn_content %}

- {{ user.name or user.email_localpart or "Add a new team member" }} + {{ user.name or user.email_localpart or "Invite a team member" }}

diff --git a/app/templates/views/manage-users.html b/app/templates/views/manage-users.html index 0876f8f5b..e0f7fe1a5 100644 --- a/app/templates/views/manage-users.html +++ b/app/templates/views/manage-users.html @@ -16,11 +16,16 @@ Manage users – GOV.UK Notify {% block maincolumn_content %} -

- Manage team -

- - Invite a team member +
+
+

+ Manage team +

+
+ +
{% call(item) list_table( users, caption='Active', **table_options diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index c285f6c7d..b05e06025 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -7,7 +7,7 @@ {% block maincolumn_content %} -

Service settings

+

Manage settings

{{ browse_list([ { diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index a335ea8be..d0ed7e571 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -123,7 +123,7 @@ def test_should_show_page_for_inviting_user( client.login(api_user_active) response = client.get(url_for('main.invite_user', service_id=55555)) - assert 'Add a new team member' in response.get_data(as_text=True) + assert 'Invite a team member' in response.get_data(as_text=True) assert response.status_code == 200 @@ -277,6 +277,6 @@ def test_user_cant_invite_themselves( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - assert page.h1.string.strip() == 'Add a new team member' + assert page.h1.string.strip() == 'Invite a team member' form_error = page.find('span', class_='error-message').string.strip() assert form_error == "You can't send an invitation to yourself" From 144de217452f5e124cd898645075576c4b4399d3 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 11 Mar 2016 15:08:31 +0000 Subject: [PATCH 5/5] Make nav and page headings reflect permissions > If you have the Edit templates permission but not the Send messages permission, the navigation should read > > - Text message templates > - Email templates > - Letter templates > > The page headings should also read > > - Text message templates > - Email templates > - Letter templates respectively https://www.pivotaltracker.com/story/show/115488955 --- app/main/views/send.py | 4 ++-- app/templates/main_nav.html | 4 ++-- app/templates/views/letters.html | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index f80da4eb3..155a55e22 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -37,8 +37,8 @@ send_messages_page_headings = { manage_templates_page_headings = { - 'email': 'Manage templates', - 'sms': 'Manage templates' + 'email': 'Email templates', + 'sms': 'Text message templates' } diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index 3f2727e40..bafcfae2e 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -10,9 +10,9 @@ {% elif current_user.has_permissions(['manage_templates']) %} {% endif %} {% if current_user.has_permissions(['manage_users', 'manage_settings']) %} diff --git a/app/templates/views/letters.html b/app/templates/views/letters.html index 1086f1d50..5ef3e4d6f 100644 --- a/app/templates/views/letters.html +++ b/app/templates/views/letters.html @@ -7,7 +7,11 @@ {% block maincolumn_content %}

- Send letters + {% if current_user.has_permissions(['send_letters']) %} + Send letters + {% else %} + Letter templates + {% endif %}