From 46dcaf3e54460e089ed10d860eaea3adca983e8b Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 3 Sep 2018 14:06:07 +0100 Subject: [PATCH] Mark which brands are used as default on list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that: - we can see when a brand should be getting used as a default but isn’t - we’re careful updating brands which will get auto-applied to new services --- app/main/views/email_branding.py | 14 +++++++++++--- .../views/email-branding/select-branding.html | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/main/views/email_branding.py b/app/main/views/email_branding.py index e5f680cb4..28851a13a 100644 --- a/app/main/views/email_branding.py +++ b/app/main/views/email_branding.py @@ -11,8 +11,7 @@ from app.main.s3_client import ( persist_logo, upload_logo, ) -from app.main.views.service_settings import get_branding_as_value_and_label -from app.utils import get_cdn_domain, user_is_platform_admin +from app.utils import AgreementInfo, get_cdn_domain, user_is_platform_admin @main.route("/email-branding", methods=['GET', 'POST']) @@ -23,9 +22,10 @@ def email_branding(): return render_template( 'views/email-branding/select-branding.html', - email_brandings=get_branding_as_value_and_label(brandings), + email_brandings=_add_domain_info(brandings), search_form=SearchTemplatesForm(), show_search_box=len(brandings) > 9, + agreement_info=AgreementInfo, ) @@ -129,3 +129,11 @@ def create_email_branding(logo=None): cdn_url=get_cdn_domain(), logo=logo ) + + +def _add_domain_info(email_brands): + for brand in email_brands: + yield dict( + domain_owner=AgreementInfo(brand.get('domain') or '').owner, + **brand + ) diff --git a/app/templates/views/email-branding/select-branding.html b/app/templates/views/email-branding/select-branding.html index 6fa134f57..57af562a1 100644 --- a/app/templates/views/email-branding/select-branding.html +++ b/app/templates/views/email-branding/select-branding.html @@ -17,13 +17,20 @@ Add new brand - {{ live_search(target_selector='.message-name', show=show_search_box, form=search_form) }} + {{ live_search(target_selector='.email-brand', show=show_search_box, form=search_form) }}