Show domains, not owners against brands

The owner is often repetetive, eg

> *Hackney Council*
> Default for Hackney Council

Instead it’s more useful to reflect what the person setting up the brand
has entered – the domain.

This also adds an empty hint for non-default brands so that the page is
evenly spaced and nothing overlaps.
This commit is contained in:
Chris Hill-Scott
2019-01-23 14:16:44 +00:00
parent a9effaa82e
commit 88f868c57d
3 changed files with 17 additions and 16 deletions
+1 -9
View File
@@ -22,7 +22,7 @@ def email_branding():
return render_template( return render_template(
'views/email-branding/select-branding.html', 'views/email-branding/select-branding.html',
email_brandings=_add_domain_info(brandings), email_brandings=brandings,
search_form=SearchTemplatesForm(), search_form=SearchTemplatesForm(),
show_search_box=len(brandings) > 9, show_search_box=len(brandings) > 9,
agreement_info=AgreementInfo, agreement_info=AgreementInfo,
@@ -129,11 +129,3 @@ def create_email_branding(logo=None):
cdn_url=get_logo_cdn_domain(), cdn_url=get_logo_cdn_domain(),
logo=logo logo=logo
) )
def _add_domain_info(email_brands):
for brand in email_brands:
yield dict(
domain_owner=AgreementInfo(brand.get('domain') or '').owner,
**brand
)
@@ -26,11 +26,13 @@
{{ brand.name or 'Unnamed' }} {{ brand.name or 'Unnamed' }}
</a> </a>
</div> </div>
{% if brand.domain_owner %} <p class="message-type">
<p class="message-type"> {% if brand.domain %}
Default for {{ brand.domain_owner }} Default for {{ brand.domain }}
</p> {% else %}
{% endif %}
{% endif %}
</p>
</div> </div>
{% endfor %} {% endfor %}
</nav> </nav>
+9 -2
View File
@@ -27,6 +27,7 @@ def test_email_branding_page_shows_full_branding_list(
links = page.select('.message-name a') links = page.select('.message-name a')
brand_names = [normalize_spaces(link.text) for link in links] brand_names = [normalize_spaces(link.text) for link in links]
hrefs = [link['href'] for link in links] hrefs = [link['href'] for link in links]
brand_hints = [normalize_spaces(hint.text) for hint in page.select('.message-type')]
assert normalize_spaces( assert normalize_spaces(
page.select_one('h1').text page.select_one('h1').text
@@ -34,8 +35,14 @@ def test_email_branding_page_shows_full_branding_list(
assert page.select_one('.column-three-quarters a')['href'] == url_for('main.create_email_branding') assert page.select_one('.column-three-quarters a')['href'] == url_for('main.create_email_branding')
assert brand_names == [ assert list(zip(
'org 1', 'org 2', 'org 3', 'org 4', 'org 5' brand_names, brand_hints
)) == [
('org 1', ''),
('org 2', ''),
('org 3', ''),
('org 4', 'Default for nhs.uk'),
('org 5', 'Default for voa.gov.uk'),
] ]
assert hrefs == [ assert hrefs == [
url_for('.update_email_branding', branding_id=1), url_for('.update_email_branding', branding_id=1),