Mark which brands are used as default on list

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
This commit is contained in:
Chris Hill-Scott
2018-09-03 14:06:07 +01:00
parent 243fdb0260
commit 46dcaf3e54
2 changed files with 24 additions and 9 deletions

View File

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

View File

@@ -17,13 +17,20 @@
<a href="{{ url_for('.create_email_branding') }}" class="button align-with-heading">Add new brand</a>
</div>
</div>
{{ 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) }}
<nav>
{% for id, name in email_brandings %}
<div class="message-name">
<a href="{{ url_for('.update_email_branding', branding_id=id) }}">
{{name}}
</a>
{% for brand in email_brandings %}
<div class="email-brand">
<div class="message-name">
<a href="{{ url_for('.update_email_branding', branding_id=brand.id) }}">
{{ brand.name }}
</a>
</div>
{% if brand.domain_owner %}
<p class="message-type">
Default for {{ brand.domain_owner }}
</p>
{% endif %}
</div>
{% endfor %}
</nav>