From a5a35f1a6bbadbfef849ca24dfe858401a60bcd1 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 1 Jul 2016 10:40:34 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Don=E2=80=99t=20create=20an=20example=20ema?= =?UTF-8?q?il=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We reckon that: - a ‘blank slate’ templates page is a better start - the example template hurt more than it helped when it comes to understanding placeholders --- app/main/views/add_service.py | 7 ------- tests/app/main/views/test_add_service.py | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/main/views/add_service.py b/app/main/views/add_service.py index 71e9eee58..7fa36a05d 100644 --- a/app/main/views/add_service.py +++ b/app/main/views/add_service.py @@ -53,13 +53,6 @@ def add_service(): 'Hey ((name)), I’m trying out Notify. Today is ((day of week)) and my favourite colour is ((colour)).', service_id ) - example_email_template = service_api_client.create_service_template( - 'Example email template', - 'email', - 'Hey ((name)),\n\nI’m trying out Notify. Today is ((day of week)) and my favourite colour is ((colour)).', - service_id, - 'Trying out Notify' - ) return redirect(url_for( 'main.send_test', diff --git a/tests/app/main/views/test_add_service.py b/tests/app/main/views/test_add_service.py index fa0993127..564181830 100644 --- a/tests/app/main/views/test_add_service.py +++ b/tests/app/main/views/test_add_service.py @@ -35,7 +35,7 @@ def test_should_add_service_and_redirect_to_tour_when_no_services(app_, user_id=api_user_active.id, email_from='testing.the.post' ) - assert len(mock_create_service_template.call_args_list) == 2 + assert len(mock_create_service_template.call_args_list) == 1 assert session['service_id'] == 101 assert response.status_code == 302 assert response.location == url_for( From 721212816db5a009648c24625adce4724d194cf4 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 1 Jul 2016 10:49:54 +0100 Subject: [PATCH 2/4] Redirect to the dashboard after the tour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the tour we should ground users by dropping them on the dashboard. In the background, we delete the example text message template. This means that users start from a clean slate when they go to add their own templates This also means some wording changes to the tour so it still makes (some) sense: - 1, 2 and 3 should refer to the current step, not describe the next one - the link should take you to the dashboard - change from ‘Get started’ to ‘Try this example’ because we’re using ‘Get started on the dashboard’ --- app/main/views/send.py | 12 ++++++++++++ app/templates/main_nav.html | 13 +++++-------- tests/app/main/views/test_send.py | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 4615491a9..c3a0fcb2f 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -312,3 +312,15 @@ def start_job(service_id, upload_id): return redirect( url_for('main.view_job', job_id=upload_id, service_id=service_id, help=request.form.get('help')) ) + + +@main.route("/services//end-tour/") +@login_required +@user_has_permissions('manage_templates') +def go_to_dashboard_after_tour(service_id, example_template_id): + + service_api_client.delete_service_template(service_id, example_template_id) + + return redirect( + url_for('main.service_dashboard', service_id=service_id) + ) diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index 733379e1d..1fdfb461c 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -2,14 +2,14 @@ {% if request.args['help'] and request.args['help'] != '0' %} {% call banner_wrapper(type='tour') %} -

Get started

+

Try this example

1.

- Send yourself this example message + Every message is sent from a template

@@ -29,14 +29,11 @@

- Now try it with your own message + Notify delivers the message

{% if request.args['help'] == '3' %} - - Write an email - - - Write a text message + + Now go to your dashboard {% endif %}
diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 753a205f5..4f3f431a3 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -696,3 +696,26 @@ def test_send_and_check_page_renders_if_no_statistics( page = BeautifulSoup(resp.data.decode('utf-8'), 'html.parser') assert page.h1.text.strip() == 'Check and confirm' mock_get_stats.assert_called_once_with(fake_uuid, today) + + +def test_go_to_dashboard_after_tour( + app_, + mocker, + api_user_active, + mock_login, + mock_get_service, + mock_has_permissions, + mock_delete_service_template, + fake_uuid +): + + with app_.test_request_context(), app_.test_client() as client: + client.login(api_user_active) + + resp = client.get( + url_for('main.go_to_dashboard_after_tour', service_id=fake_uuid, example_template_id=fake_uuid) + ) + + assert resp.status_code == 302 + assert resp.location == url_for("main.service_dashboard", service_id=fake_uuid, _external=True) + mock_delete_service_template.assert_called_once_with(fake_uuid, fake_uuid) From 9e98ed33049e17a33312031676132f502bf9865a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 1 Jul 2016 10:51:40 +0100 Subject: [PATCH 3/4] Remove trial mode banner from dashboard No-one ever looked at this. --- app/templates/views/dashboard/dashboard.html | 8 +------- .../views/dashboard/trial-mode-banner.html | 13 ------------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 app/templates/views/dashboard/trial-mode-banner.html diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index e79f0d8e6..5af2c752e 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -10,13 +10,7 @@

Dashboard

- {% if current_user.has_permissions([ - 'manage_templates', 'manage_api_keys', 'manage_users', 'manage_settings - '], any_=True, admin_override=True) %} - {% if current_service.restricted %} - {% include 'views/dashboard/trial-mode-banner.html' %} - {% endif %} - {% elif not current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], any_=True) %} + {% if not current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], any_=True) %} {% include 'views/dashboard/no-permissions-banner.html' %} {% endif %} diff --git a/app/templates/views/dashboard/trial-mode-banner.html b/app/templates/views/dashboard/trial-mode-banner.html deleted file mode 100644 index 87c78cbc2..000000000 --- a/app/templates/views/dashboard/trial-mode-banner.html +++ /dev/null @@ -1,13 +0,0 @@ -{% from "components/banner.html" import banner_wrapper %} -{% from "components/big-number.html" import big_number %} - -{% call banner_wrapper(type="mode") %} -
-
- Your service is in trial mode -
- -
-{% endcall %} From 25829762bf6d8cfe1488ed0fc7675d346d7989e8 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 1 Jul 2016 11:07:44 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Add=20=E2=80=98get=20started=E2=80=99=20bac?= =?UTF-8?q?k=20to=20the=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we’re removing the write email/write text message calls to action from the tour, we should reintroduce them to the dashboard, for users who are unsure what they should do next. --- app/assets/stylesheets/components/banner.scss | 14 ++++++++------ app/templates/views/dashboard/dashboard.html | 6 +++++- .../views/dashboard/write-first-messages.html | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 app/templates/views/dashboard/write-first-messages.html diff --git a/app/assets/stylesheets/components/banner.scss b/app/assets/stylesheets/components/banner.scss index 97154f5fd..82c45ccec 100644 --- a/app/assets/stylesheets/components/banner.scss +++ b/app/assets/stylesheets/components/banner.scss @@ -76,18 +76,14 @@ @extend %banner; background: $govuk-blue; color: $white; - margin-top: $gutter; + margin: 0 0 $gutter 0; padding: $gutter-half; p { margin: 0 0 10px 0; } - &-action { - - display: block; - text-align: right; - float: right; + a { &:link, &:visited { @@ -107,6 +103,12 @@ } + &-action { + display: block; + text-align: right; + float: right; + } + } .banner-intro { diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 5af2c752e..ea5e6433e 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -10,7 +10,11 @@

Dashboard

- {% if not current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], any_=True) %} + {% if current_user.has_permissions(['manage_templates'], admin_override=True) %} + {% if not templates %} + {% include 'views/dashboard/write-first-messages.html' %} + {% endif %} + {% elif not current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], any_=True) %} {% include 'views/dashboard/no-permissions-banner.html' %} {% endif %} diff --git a/app/templates/views/dashboard/write-first-messages.html b/app/templates/views/dashboard/write-first-messages.html new file mode 100644 index 000000000..ad5f61465 --- /dev/null +++ b/app/templates/views/dashboard/write-first-messages.html @@ -0,0 +1,16 @@ +{% from "components/banner.html" import banner_wrapper %} + +

Get started

+ +