From d29f23bfc840eaaed24feefe126b9caf38fde3d3 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 24 Jan 2020 15:57:29 +0000 Subject: [PATCH] Add left hand navigation Due to the way the navigation dictionaries are built this mean being less smart about the view method for the guidance pages. --- app/main/views/index.py | 85 +++++++++++++++---- app/main/views/sub_navigation_dictionaries.py | 12 +-- app/navigation.py | 32 ++++++- app/templates/admin_template.html | 2 +- app/templates/views/features.html | 2 +- app/templates/views/features/emails.html | 4 +- app/templates/views/features/letters.html | 4 +- .../views/features/text-messages.html | 2 +- app/templates/views/guidance/index.html | 12 +-- tests/app/main/views/test_index.py | 25 +----- 10 files changed, 119 insertions(+), 61 deletions(-) diff --git a/app/main/views/index.py b/app/main/views/index.py index 1ee5db928..944650e57 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -7,7 +7,6 @@ from flask import ( url_for, ) from flask_login import current_user -from jinja2.exceptions import TemplateNotFound from notifications_utils.international_billing_rates import ( INTERNATIONAL_BILLING_RATES, ) @@ -17,7 +16,11 @@ from app import email_branding_client, letter_branding_client, status_api_client from app.main import main from app.main.forms import FieldWithNoneOption, SearchByNameForm from app.main.views.feedback import QUESTION_TICKET_TYPE -from app.main.views.sub_navigation_dictionaries import features_nav, pricing_nav +from app.main.views.sub_navigation_dictionaries import ( + features_nav, + pricing_nav, + using_notify_nav, +) from app.utils import get_logo_cdn_domain, user_is_logged_in @@ -91,6 +94,7 @@ def how_to_pay(): @main.route('/delivery-and-failure') +@main.route('/features/messages-status') def delivery_and_failure(): return redirect(url_for('.message_status'), 301) @@ -219,7 +223,10 @@ def letter_template(): @main.route('/documentation') def documentation(): - return render_template('views/documentation.html') + return render_template( + 'views/documentation.html', + navigation_links=using_notify_nav(), + ) @main.route('/integration-testing') @@ -298,43 +305,87 @@ def using_notify(): ), 410 -@main.route('/features/messages-status') +@main.route('/using-notify/delivery-status') def message_status(): return render_template( 'views/message-status.html', - navigation_links=features_nav() + navigation_links=using_notify_nav(), ) @main.route('/features/get-started') +def get_started_old(): + return redirect(url_for('.get_started'), 301) + + +@main.route('/using-notify/get-started') def get_started(): return render_template( - 'views/get-started.html' + 'views/get-started.html', + navigation_links=using_notify_nav(), ) @main.route('/trial-mode') +@main.route('/features/trial-mode') def trial_mode(): return redirect(url_for('.trial_mode_new'), 301) -@main.route('/features/trial-mode') +@main.route('/using-notify/trial-mode') def trial_mode_new(): return render_template( 'views/trial-mode.html', - navigation_links=features_nav() + navigation_links=using_notify_nav(), ) -@main.route('/guidance') -@main.route('/guidance/') -def guidance(slug='index'): - try: - return render_template( - 'views/guidance/{}.html'.format(slug) - ) - except TemplateNotFound: - abort(404) +@main.route('/using-notify/guidance') +def guidance_index(): + return render_template( + 'views/guidance/index.html', + navigation_links=using_notify_nav(), + ) + + +@main.route('/using-notify/guidance/branding-and-customisation') +def branding_and_customisation(): + return render_template( + 'views/guidance/branding-and-customisation.html', + navigation_links=using_notify_nav(), + ) + + +@main.route('/using-notify/guidance/create-and-send-messages') +def create_and_send_messages(): + return render_template( + 'views/guidance/create-and-send-messages.html', + navigation_links=using_notify_nav(), + ) + + +@main.route('/using-notify/guidance/edit-and-format-messages') +def edit_and_format_messages(): + return render_template( + 'views/guidance/edit-and-format-messages.html', + navigation_links=using_notify_nav(), + ) + + +@main.route('/using-notify/guidance/send-files-by-email') +def send_files_by_email(): + return render_template( + 'views/guidance/send-files-by-email.html', + navigation_links=using_notify_nav(), + ) + + +@main.route('/using-notify/guidance/upload-a-letter') +def upload_a_letter(): + return render_template( + 'views/guidance/upload-a-letter.html', + navigation_links=using_notify_nav(), + ) # --- Redirects --- # diff --git a/app/main/views/sub_navigation_dictionaries.py b/app/main/views/sub_navigation_dictionaries.py index 06c319b07..b65b72916 100644 --- a/app/main/views/sub_navigation_dictionaries.py +++ b/app/main/views/sub_navigation_dictionaries.py @@ -62,27 +62,27 @@ def using_notify_nav(): }, { "name": "Guidance", - "link": "main.guidance", + "link": "main.guidance_index", "sub_navigation_items": [ { "name": "Create and send messages", - "link": "main.features_email", + "link": "main.create_and_send_messages", }, { "name": "Edit and format messages", - "link": "main.features_sms", + "link": "main.edit_and_format_messages", }, { "name": "Branding and customisation", - "link": "main.features_letters", + "link": "main.branding_and_customisation", }, { "name": "Send files by email", - "link": "main.features_letters", + "link": "main.send_files_by_email", }, { "name": "Upload your own letters", - "link": "main.features_letters", + "link": "main.upload_a_letter", }, ] }, diff --git a/app/navigation.py b/app/navigation.py index baf6b1aae..627445421 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -196,8 +196,14 @@ class HeaderNavigation(Navigation): 'get_example_csv', 'get_notifications_as_json', 'get_started', + 'get_started_old', 'go_to_dashboard_after_tour', - 'guidance', + 'guidance_index', + 'branding_and_customisation', + 'create_and_send_messages', + 'edit_and_format_messages', + 'send_files_by_email', + 'upload_a_letter', 'history', 'inbound_sms_admin', 'inbox', @@ -520,8 +526,14 @@ class MainNavigation(Navigation): 'get_example_csv', 'get_notifications_as_json', 'get_started', + 'get_started_old', 'go_to_dashboard_after_tour', - 'guidance', + 'guidance_index', + 'branding_and_customisation', + 'create_and_send_messages', + 'edit_and_format_messages', + 'send_files_by_email', + 'upload_a_letter', 'history', 'how_to_pay', 'inbound_sms_admin', @@ -752,8 +764,14 @@ class CaseworkNavigation(Navigation): 'get_example_csv', 'get_notifications_as_json', 'get_started', + 'get_started_old', 'go_to_dashboard_after_tour', - 'guidance', + 'guidance_index', + 'branding_and_customisation', + 'create_and_send_messages', + 'edit_and_format_messages', + 'send_files_by_email', + 'upload_a_letter', 'history', 'how_to_pay', 'inbound_sms_admin', @@ -1041,8 +1059,14 @@ class OrgNavigation(Navigation): 'get_example_csv', 'get_notifications_as_json', 'get_started', + 'get_started_old', 'go_to_dashboard_after_tour', - 'guidance', + 'guidance_index', + 'branding_and_customisation', + 'create_and_send_messages', + 'edit_and_format_messages', + 'send_files_by_email', + 'upload_a_letter', 'history', 'how_to_pay', 'inbound_sms_admin', diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index dde9ea393..91eec3123 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -226,7 +226,7 @@ "text": "Delivery status" }, { - "href": url_for("main.guidance"), + "href": url_for("main.guidance_index"), "text": "Guidance" }, { diff --git a/app/templates/views/features.html b/app/templates/views/features.html index 27126bb14..a0cdf2be3 100644 --- a/app/templates/views/features.html +++ b/app/templates/views/features.html @@ -27,7 +27,7 @@

Personalised content

Notify makes it easy to send personalised messages from a single template.

-

See how to personalise your content.

+

See how to personalise your content.

Bulk sending

To send a batch of messages at once, upload a list of contact details to Notify. If you’re sending emails and text messages, you can also schedule the date and time you want them to be sent.

diff --git a/app/templates/views/features/emails.html b/app/templates/views/features/emails.html index 40c02d8d9..f9ddc5693 100644 --- a/app/templates/views/features/emails.html +++ b/app/templates/views/features/emails.html @@ -24,7 +24,7 @@

Email branding

Add your organisation’s logo and brand colour to email templates.

-

See how to change your email branding.

+

See how to change your email branding.

Send files by email

Notify offers a safe and reliable way to send files by email.

@@ -41,7 +41,7 @@

Add a reply-to address

Notify lets you choose the email address that users reply to.

Emails with a reply-to address seem more trustworthy and are less likely to be labelled as spam.

-

See how to add a reply-to address.

+

See how to add a reply-to address.

Pricing

It’s free to send emails through Notify.

diff --git a/app/templates/views/features/letters.html b/app/templates/views/features/letters.html index 3d0f60dc7..4eea66c9a 100644 --- a/app/templates/views/features/letters.html +++ b/app/templates/views/features/letters.html @@ -29,11 +29,11 @@

Branding

Add your organisation’s logo to your letter templates.

-

See how to change your letter branding.

+

See how to change your letter branding.

Upload your own letters

You can create reusable letter templates in Notify, or upload and send your own letters with the Notify API.

-

See how to upload a letter.

+

See how to upload a letter.

Or, if you’re using our API, read our documentation.

Pricing

diff --git a/app/templates/views/features/text-messages.html b/app/templates/views/features/text-messages.html index 21ba3e0c9..270e192f5 100644 --- a/app/templates/views/features/text-messages.html +++ b/app/templates/views/features/text-messages.html @@ -28,7 +28,7 @@

Show people who your texts are from

When you send a text message with Notify, the sender name tells people who it's from.

-

See how to change the text message sender.

+

See how to change the text message sender.

Pricing

Each service you add has a free annual allowance. After that it costs 1.58 pence (plus VAT) to send a text to a UK number.

diff --git a/app/templates/views/guidance/index.html b/app/templates/views/guidance/index.html index eba9c07e9..0f7132f35 100644 --- a/app/templates/views/guidance/index.html +++ b/app/templates/views/guidance/index.html @@ -15,17 +15,17 @@

It explains how to:

More information

The GOV.UK Service Manual has advice on:

- +