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/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/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/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index e79f0d8e6..ea5e6433e 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -10,11 +10,9 @@

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' %} + {% 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' %} 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 %} 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

+ + 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( 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)