mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
Merge pull request #744 from alphagov/tour-to-dashboard
Go to the dashboard after finishing the tour
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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/<service_id>/end-tour/<example_template_id>")
|
||||
@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)
|
||||
)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
{% if request.args['help'] and request.args['help'] != '0' %}
|
||||
{% call banner_wrapper(type='tour') %}
|
||||
<p class="heading-medium">Get started</p>
|
||||
<p class="heading-medium">Try this example</p>
|
||||
<div class="grid-row bottom-gutter" {% if request.args['help'] != '1' %}style="opacity: 0.6"{% endif %}>
|
||||
<div class="column-one-sixth">
|
||||
<p class="heading-large" style="float: left;">1.</p>
|
||||
</div>
|
||||
<div class="column-five-sixths">
|
||||
<p>
|
||||
Send yourself this example message
|
||||
Every message is sent from a template
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,14 +29,11 @@
|
||||
</div>
|
||||
<div class="column-five-sixths">
|
||||
<p>
|
||||
Now try it with your own message
|
||||
Notify delivers the message
|
||||
</p>
|
||||
{% if request.args['help'] == '3' %}
|
||||
<a href='{{ url_for(".choose_template", service_id=current_service.id, template_type="email") }}'>
|
||||
Write an email
|
||||
</a>
|
||||
<a href='{{ url_for(".choose_template", service_id=current_service.id, template_type="sms") }}'>
|
||||
Write a text message
|
||||
<a href='{{ url_for(".go_to_dashboard_after_tour", service_id=current_service.id, example_template_id=template.id) }}'>
|
||||
Now go to your dashboard
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
|
||||
<h1 class="visuallyhidden">Dashboard</h1>
|
||||
|
||||
{% 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' %}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/big-number.html" import big_number %}
|
||||
|
||||
{% call banner_wrapper(type="mode") %}
|
||||
<div class="grid-row">
|
||||
<div class="column-one-half">
|
||||
Your service is in trial mode
|
||||
</div>
|
||||
<div class="column-one-half">
|
||||
<a href="{{ url_for(".trial_mode") }}" class="banner-mode-action">Find out more<span class="visuallyhidden"> about trial mode</span></a>
|
||||
</div>
|
||||
</div>
|
||||
{% endcall %}
|
||||
16
app/templates/views/dashboard/write-first-messages.html
Normal file
16
app/templates/views/dashboard/write-first-messages.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
|
||||
<h2 class="heading-medium">Get started</h2>
|
||||
|
||||
<nav class="grid-row">
|
||||
<div class="column-half">
|
||||
{% call banner_wrapper(type="mode") %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type='email') }}">Write an email
|
||||
{% endcall %}
|
||||
</div>
|
||||
<div class="column-half">
|
||||
{% call banner_wrapper(type="mode") %}
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type='email') }}">Write a text message</a>
|
||||
{% endcall %}
|
||||
</div>
|
||||
</nav>
|
||||
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user