mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-19 14:03:52 -04:00
Redirect to the dashboard after the tour
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’
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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