From 0e7ed2b0cfc6c2f0d8e5a28af239bda1e1d73c46 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 23 Aug 2018 08:56:36 +0100 Subject: [PATCH] =?UTF-8?q?Put=20=E2=80=98add=20new=E2=80=99=20button=20at?= =?UTF-8?q?=20top=20of=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One of the most frequent tasks done on this page is adding a new branding. Current to do this you have to: - scroll to the bottom - scan for the ‘Create a new email branding’ option that visually looks just like all the other brandings - submit a form This commit makes change it to one clearly differentiated button at the top of the page. This is consistent for how we let users add templates and team members. --- app/main/views/email_branding.py | 7 ++----- .../views/email-branding/select-branding.html | 14 +++++++++----- tests/app/main/views/test_email_branding.py | 9 +++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/main/views/email_branding.py b/app/main/views/email_branding.py index ffa36d885..62b278a9f 100644 --- a/app/main/views/email_branding.py +++ b/app/main/views/email_branding.py @@ -30,13 +30,10 @@ def email_branding(): form = ServiceSelectEmailBranding() email_brandings = get_branding_as_value_and_label(brandings) - form.email_branding.choices = email_brandings + [('None', 'Create a new email branding')] + form.email_branding.choices = email_brandings if form.validate_on_submit(): - if form.email_branding.data != 'None': - return redirect(url_for('.update_email_branding', branding_id=form.email_branding.data)) - else: - return redirect(url_for('.create_email_branding')) + return redirect(url_for('.update_email_branding', branding_id=form.email_branding.data)) return render_template( 'views/email-branding/select-branding.html', diff --git a/app/templates/views/email-branding/select-branding.html b/app/templates/views/email-branding/select-branding.html index ec846151e..16324b893 100644 --- a/app/templates/views/email-branding/select-branding.html +++ b/app/templates/views/email-branding/select-branding.html @@ -4,15 +4,19 @@ {% from "components/live-search.html" import live_search %} {% block service_page_title %} - Select email branding + Email branding {% endblock %} {% block platform_admin_content %} -

-
Select an email branding to update
-
or create a new email branding
-

+
+
+

Email branding

+
+ +
diff --git a/tests/app/main/views/test_email_branding.py b/tests/app/main/views/test_email_branding.py index 9bef00beb..6e652611c 100644 --- a/tests/app/main/views/test_email_branding.py +++ b/tests/app/main/views/test_email_branding.py @@ -25,14 +25,15 @@ def test_email_branding_page_shows_full_branding_list( assert normalize_spaces( page.select_one('h1').text - ) == "Select an email branding to update or create a new email branding" + ) == "Email branding" + + assert page.select_one('.column-three-quarters a')['href'] == url_for('main.create_email_branding') first_label = radio_labels[0] assert normalize_spaces(first_label.text) == 'org 1' assert brand_names == [ - 'org 1', 'org 2', 'org 3', 'org 4', 'org 5', 'Create a new email branding'] - - assert normalize_spaces((radio_labels[-1]).text) == 'Create a new email branding' + 'org 1', 'org 2', 'org 3', 'org 4', 'org 5' + ] def test_edit_email_branding_shows_the_correct_branding_info(