Put ‘add new’ button at top of page

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.
This commit is contained in:
Chris Hill-Scott
2018-08-23 08:56:36 +01:00
parent 7d6714ed68
commit 0e7ed2b0cf
3 changed files with 16 additions and 14 deletions

View File

@@ -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',

View File

@@ -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 %}
<h1 class="heading-large">
<div>Select an email branding to update</div>
<div>or create a new email branding</div>
</h1>
<div class="grid-row bottom-gutter-2-3">
<div class="column-two-thirds">
<h1 class="heading-large">Email branding</h1>
</div>
<div class="column-one-third">
<a href="{{ url_for('.create_email_branding') }}" class="button align-with-heading">Add new brand</a>
</div>
</div>
<div class="grid-row">
<div class="column-three-quarters">
<form method="post">

View File

@@ -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(