Add view for new tour start page

This will replace the current tour start page
This commit is contained in:
David McDonald
2020-09-29 14:48:56 +01:00
parent f4f2e5d13a
commit 2ba7224a42
7 changed files with 181 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ from app.main.views import ( # noqa isort:skip
styleguide,
templates,
two_factor,
tour,
uploads,
user_profile,
verify,

View File

@@ -100,6 +100,7 @@ def start_tour(service_id, template_id):
show_recipient=True,
),
help='1',
continue_link=url_for('.send_test', service_id=current_service.id, template_id=template['id'], help=2)
)

38
app/main/views/tour.py Normal file
View File

@@ -0,0 +1,38 @@
from flask import abort, render_template
from app import current_service, current_user, url_for
from app.main import main
from app.utils import get_template, user_has_permissions
@main.route("/services/<uuid:service_id>/tour/<uuid:template_id>")
@user_has_permissions('send_messages')
def begin_tour(service_id, template_id):
db_template = current_service.get_template(template_id)
if (db_template['template_type'] != 'sms' or not current_user.mobile_number):
abort(404)
template = get_template(
db_template,
current_service,
show_recipient=True,
)
template.values = {"phone_number": current_user.mobile_number}
return render_template(
'views/templates/start-tour.html',
template=template,
help='1',
continue_link=url_for('.tour_step', service_id=service_id, template_id=template_id, step_index=1)
)
@main.route(
"/services/<uuid:service_id>/tour/<uuid:template_id>/step-<int:step_index>",
methods=['GET', 'POST'],
)
@user_has_permissions('send_messages', restrict_admin_usage=True)
def tour_step(service_id, template_id, step_index):
pass

View File

@@ -140,6 +140,7 @@ class HeaderNavigation(Navigation):
'api_integration',
'api_keys',
'archive_service',
'begin_tour',
'branding_request',
'callbacks',
'cancel_invited_org_user',
@@ -325,6 +326,7 @@ class HeaderNavigation(Navigation):
'submit_request_to_go_live',
'template_history',
'template_usage',
'tour_step',
'trial_mode',
'upload_contact_list',
'check_contact_list',
@@ -527,6 +529,7 @@ class MainNavigation(Navigation):
'archive_service',
'archive_user',
'bat_phone',
'begin_tour',
'callbacks',
'cancel_invited_org_user',
'cancel_invited_user',
@@ -668,6 +671,7 @@ class MainNavigation(Navigation):
'template_history',
'terms',
'thanks',
'tour_step',
'triage',
'trial_mode',
'trial_mode_new',
@@ -762,6 +766,7 @@ class CaseworkNavigation(Navigation):
'archive_service',
'archive_user',
'bat_phone',
'begin_tour',
'branding_request',
'callbacks',
'cancel_invited_org_user',
@@ -980,6 +985,7 @@ class CaseworkNavigation(Navigation):
'template_usage',
'terms',
'thanks',
'tour_step',
'triage',
'trial_mode',
'trial_mode_new',
@@ -1088,6 +1094,7 @@ class OrgNavigation(Navigation):
'archive_service',
'archive_user',
'bat_phone',
'begin_tour',
'branding_request',
'callbacks',
'cancel_invited_org_user',
@@ -1292,6 +1299,7 @@ class OrgNavigation(Navigation):
'template_usage',
'terms',
'thanks',
'tour_step',
'triage',
'trial_mode',
'trial_mode_new',

View File

@@ -17,7 +17,7 @@
{{ govukButton({
"element": "a",
"text": "Continue",
"href": url_for('.send_test', service_id=current_service.id, template_id=template.id, help=2),
"href": continue_link,
}) }}
</div>