2018-03-09 11:56:34 +00:00
|
|
|
|
from flask import abort, redirect, render_template, request, url_for
|
2018-02-20 11:22:17 +00:00
|
|
|
|
from flask_login import current_user, login_required
|
|
|
|
|
|
from notifications_utils.international_billing_rates import (
|
|
|
|
|
|
INTERNATIONAL_BILLING_RATES,
|
|
|
|
|
|
)
|
2016-12-08 11:50:59 +00:00
|
|
|
|
from notifications_utils.template import HTMLEmailTemplate
|
2016-07-04 16:25:20 +01:00
|
|
|
|
|
2018-02-20 11:22:17 +00:00
|
|
|
|
from app import convert_to_boolean
|
|
|
|
|
|
from app.main import main
|
|
|
|
|
|
from app.main.forms import SearchTemplatesForm
|
2017-11-28 11:56:30 +00:00
|
|
|
|
from app.main.views.sub_navigation_dictionaries import features_nav
|
2018-03-09 14:53:04 +00:00
|
|
|
|
from app.utils import AgreementInfo
|
2017-11-28 11:56:30 +00:00
|
|
|
|
|
2015-11-20 16:22:44 +00:00
|
|
|
|
|
2015-11-25 16:21:28 +00:00
|
|
|
|
@main.route('/')
|
2015-11-20 16:22:44 +00:00
|
|
|
|
def index():
|
2016-05-04 13:01:55 +01:00
|
|
|
|
if current_user and current_user.is_authenticated:
|
2018-03-08 16:51:53 +00:00
|
|
|
|
return redirect(url_for('main.choose_account'))
|
2015-12-10 14:38:24 +00:00
|
|
|
|
return render_template('views/signedout.html')
|
2015-11-23 16:07:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
2018-03-08 17:49:08 +00:00
|
|
|
|
@main.route('/error/<int:status_code>')
|
|
|
|
|
|
def error(status_code):
|
2018-03-09 12:28:55 +00:00
|
|
|
|
if status_code >= 500:
|
|
|
|
|
|
abort(404)
|
2018-03-08 17:49:08 +00:00
|
|
|
|
abort(status_code)
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-25 16:21:28 +00:00
|
|
|
|
@main.route("/verify-mobile")
|
2016-01-11 16:03:41 +00:00
|
|
|
|
@login_required
|
2016-01-15 17:46:09 +00:00
|
|
|
|
def verify_mobile():
|
2015-12-10 14:38:24 +00:00
|
|
|
|
return render_template('views/verify-mobile.html')
|
2016-03-16 11:01:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route('/cookies')
|
|
|
|
|
|
def cookies():
|
|
|
|
|
|
return render_template('views/cookies.html')
|
2016-03-17 13:44:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
2018-05-23 14:35:26 +01:00
|
|
|
|
@main.route('/privacy')
|
|
|
|
|
|
def privacy():
|
|
|
|
|
|
return render_template('views/privacy.html')
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-04 15:22:30 +01:00
|
|
|
|
@main.route('/trial-mode')
|
|
|
|
|
|
def trial_mode():
|
2017-08-30 15:22:26 +01:00
|
|
|
|
return redirect(url_for('.using_notify') + '#trial-mode', 301)
|
2016-04-04 15:22:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route('/pricing')
|
|
|
|
|
|
def pricing():
|
2017-07-28 14:28:25 +01:00
|
|
|
|
return render_template(
|
|
|
|
|
|
'views/pricing.html',
|
|
|
|
|
|
sms_rate=0.0158,
|
2017-07-28 14:58:47 +01:00
|
|
|
|
international_sms_rates=sorted([
|
|
|
|
|
|
(cc, country['names'], country['billable_units'])
|
|
|
|
|
|
for cc, country in INTERNATIONAL_BILLING_RATES.items()
|
2017-07-28 15:07:08 +01:00
|
|
|
|
], key=lambda x: x[0]),
|
|
|
|
|
|
search_form=SearchTemplatesForm(),
|
2018-03-16 11:03:30 +00:00
|
|
|
|
agreement_info=AgreementInfo.from_current_user(),
|
2017-07-28 14:28:25 +01:00
|
|
|
|
)
|
2016-03-21 14:47:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
2016-05-09 16:18:13 +01:00
|
|
|
|
@main.route('/delivery-and-failure')
|
|
|
|
|
|
def delivery_and_failure():
|
2017-08-30 15:22:26 +01:00
|
|
|
|
return redirect(url_for('.using_notify') + '#messagedeliveryandfailure', 301)
|
2016-05-09 16:18:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
2016-06-08 15:48:03 +01:00
|
|
|
|
@main.route('/design-patterns-content-guidance')
|
|
|
|
|
|
def design_content():
|
|
|
|
|
|
return render_template('views/design-patterns-content-guidance.html')
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 16:25:20 +01:00
|
|
|
|
@main.route('/_email')
|
|
|
|
|
|
def email_template():
|
2016-12-08 11:50:59 +00:00
|
|
|
|
return str(HTMLEmailTemplate({'subject': 'foo', 'content': (
|
2016-07-04 16:25:20 +01:00
|
|
|
|
'Lorem Ipsum is simply dummy text of the printing and typesetting '
|
|
|
|
|
|
'industry.\n\nLorem Ipsum has been the industry’s standard dummy '
|
|
|
|
|
|
'text ever since the 1500s, when an unknown printer took a galley '
|
|
|
|
|
|
'of type and scrambled it to make a type specimen book. '
|
|
|
|
|
|
'\n\n'
|
|
|
|
|
|
'# History'
|
|
|
|
|
|
'\n\n'
|
|
|
|
|
|
'It has '
|
|
|
|
|
|
'survived not only'
|
2016-09-19 09:37:55 +01:00
|
|
|
|
'\n\n'
|
|
|
|
|
|
'* five centuries'
|
2016-07-04 16:25:20 +01:00
|
|
|
|
'\n'
|
|
|
|
|
|
'* but also the leap into electronic typesetting'
|
|
|
|
|
|
'\n\n'
|
|
|
|
|
|
'It was '
|
|
|
|
|
|
'popularised in the 1960s with the release of Letraset sheets '
|
|
|
|
|
|
'containing Lorem Ipsum passages, and more recently with desktop '
|
|
|
|
|
|
'publishing software like Aldus PageMaker including versions of '
|
|
|
|
|
|
'Lorem Ipsum.'
|
|
|
|
|
|
'\n\n'
|
|
|
|
|
|
'^ It is a long established fact that a reader will be distracted '
|
|
|
|
|
|
'by the readable content of a page when looking at its layout.'
|
|
|
|
|
|
'\n\n'
|
|
|
|
|
|
'The point of using Lorem Ipsum is that it has a more-or-less '
|
|
|
|
|
|
'normal distribution of letters, as opposed to using ‘Content '
|
|
|
|
|
|
'here, content here’, making it look like readable English.'
|
|
|
|
|
|
'\n\n\n'
|
2016-09-19 09:37:55 +01:00
|
|
|
|
'1. One'
|
|
|
|
|
|
'\n'
|
|
|
|
|
|
'2. Two'
|
|
|
|
|
|
'\n'
|
|
|
|
|
|
'10. Three'
|
|
|
|
|
|
'\n\n'
|
2016-07-04 16:25:20 +01:00
|
|
|
|
'This is an example of an email sent using GOV.UK Notify.'
|
2016-09-19 09:37:55 +01:00
|
|
|
|
'\n\n'
|
|
|
|
|
|
'https://www.notifications.service.gov.uk'
|
2016-12-08 11:50:59 +00:00
|
|
|
|
)}, govuk_banner=convert_to_boolean(request.args.get('govuk_banner', True))
|
|
|
|
|
|
))
|
2016-07-04 16:25:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
2016-04-15 10:48:31 +01:00
|
|
|
|
@main.route('/documentation')
|
|
|
|
|
|
def documentation():
|
2017-11-28 11:56:30 +00:00
|
|
|
|
return render_template('views/documentation.html')
|
2017-01-27 17:32:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 11:56:30 +00:00
|
|
|
|
@main.route('/integration-testing')
|
2017-01-27 17:32:20 +00:00
|
|
|
|
def integration_testing():
|
2017-11-29 13:59:01 +00:00
|
|
|
|
return render_template('views/integration-testing.html')
|
2017-03-23 15:03:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 11:56:30 +00:00
|
|
|
|
@main.route('/callbacks')
|
|
|
|
|
|
def callbacks():
|
|
|
|
|
|
return render_template('views/callbacks.html')
|
|
|
|
|
|
|
2017-06-14 16:05:20 +01:00
|
|
|
|
|
2017-11-29 13:59:01 +00:00
|
|
|
|
# --- Features page set --- #
|
2017-06-14 16:05:20 +01:00
|
|
|
|
|
|
|
|
|
|
@main.route('/features')
|
2017-06-14 16:53:16 +01:00
|
|
|
|
def features():
|
2017-11-28 11:56:30 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
|
'views/features.html',
|
|
|
|
|
|
navigation_links=features_nav()
|
|
|
|
|
|
)
|
2017-08-30 15:22:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 11:56:30 +00:00
|
|
|
|
@main.route('/features/roadmap', endpoint='roadmap')
|
|
|
|
|
|
def roadmap():
|
2017-11-29 13:59:01 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
|
'views/roadmap.html',
|
|
|
|
|
|
navigation_links=features_nav()
|
|
|
|
|
|
)
|
2017-11-28 11:56:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route('/features/security', endpoint='security')
|
|
|
|
|
|
def security():
|
2017-11-29 13:59:01 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
|
'views/security.html',
|
|
|
|
|
|
navigation_links=features_nav()
|
|
|
|
|
|
)
|
2017-11-28 11:56:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route('/features/terms', endpoint='terms')
|
|
|
|
|
|
def terms():
|
2017-11-29 13:59:01 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
|
'views/terms-of-use.html',
|
2018-03-08 12:12:18 +00:00
|
|
|
|
navigation_links=features_nav(),
|
2018-03-09 14:53:04 +00:00
|
|
|
|
agreement_info=AgreementInfo.from_current_user(),
|
2017-11-29 13:59:01 +00:00
|
|
|
|
)
|
2017-11-28 11:56:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route('/features/using-notify')
|
2017-08-30 15:22:26 +01:00
|
|
|
|
def using_notify():
|
2017-11-29 13:59:01 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
|
'views/using-notify.html',
|
|
|
|
|
|
navigation_links=features_nav()
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Redirects --- #
|
|
|
|
|
|
|
|
|
|
|
|
@main.route('/roadmap', endpoint='old_roadmap')
|
|
|
|
|
|
@main.route('/terms', endpoint='old_terms')
|
|
|
|
|
|
@main.route('/information-security', endpoint='information_security')
|
|
|
|
|
|
@main.route('/using_notify', endpoint='old_using_notify')
|
|
|
|
|
|
@main.route('/information-risk-management', endpoint='information_risk_management')
|
|
|
|
|
|
@main.route('/integration_testing', endpoint='old_integration_testing')
|
|
|
|
|
|
def old_page_redirects():
|
|
|
|
|
|
redirects = {
|
|
|
|
|
|
'main.old_roadmap': 'main.roadmap',
|
|
|
|
|
|
'main.old_terms': 'main.terms',
|
|
|
|
|
|
'main.information_security': 'main.using_notify',
|
|
|
|
|
|
'main.old_using_notify': 'main.using_notify',
|
|
|
|
|
|
'main.information_risk_management': 'main.security',
|
|
|
|
|
|
'main.old_integration_testing': 'main.integration_testing',
|
|
|
|
|
|
}
|
|
|
|
|
|
return redirect(url_for(redirects[request.endpoint]), code=301)
|