Add '/letter-branding' page to show all letter brands

This is a platform admin page which lists all letter brands and their
domain. Once the page to edit a letter brand has been created, each
brand will link to its edit page, but for now this is just a list of
brand names and domains.
This commit is contained in:
Katie Smith
2019-02-07 16:16:22 +00:00
parent f87f89bfd2
commit f78b3bff81
9 changed files with 104 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ from app.s3_client.s3_logo_client import (
persist_logo,
upload_email_logo,
)
from app.utils import AgreementInfo, get_logo_cdn_domain, user_is_platform_admin
from app.utils import get_logo_cdn_domain, user_is_platform_admin
@main.route("/email-branding", methods=['GET', 'POST'])
@@ -24,8 +24,7 @@ def email_branding():
return render_template(
'views/email-branding/select-branding.html',
email_brandings=brandings,
search_form=SearchByNameForm(),
agreement_info=AgreementInfo,
search_form=SearchByNameForm()
)

View File

@@ -12,7 +12,11 @@ from requests import get as requests_get
from app import letter_branding_client
from app.main import main
from app.main.forms import ServiceLetterBrandingDetails, SVGFileUpload
from app.main.forms import (
SearchByNameForm,
ServiceLetterBrandingDetails,
SVGFileUpload,
)
from app.s3_client.s3_logo_client import (
LETTER_TEMP_TAG,
delete_letter_temp_file,
@@ -27,6 +31,20 @@ from app.s3_client.s3_logo_client import (
from app.utils import get_logo_cdn_domain, user_is_platform_admin
@main.route("/letter-branding", methods=['GET'])
@login_required
@user_is_platform_admin
def letter_branding():
brandings = letter_branding_client.get_all_letter_branding()
return render_template(
'views/letter-branding/select-letter-branding.html',
letter_brandings=brandings,
search_form=SearchByNameForm()
)
@main.route("/letter-branding/create", methods=['GET', 'POST'])
@main.route("/letter-branding/create/<path:logo>", methods=['GET', 'POST'])
@login_required
@@ -65,8 +83,7 @@ def create_letter_branding(logo=None):
upload_letter_logos(logo, db_filename, png_file, session['user_id'])
# TODO: redirect to all letter branding page once it exists
return redirect(url_for('main.platform_admin'))
return redirect(url_for('main.letter_branding'))
except HTTPError as e:
if 'domain' in e.message:

View File

@@ -78,6 +78,7 @@ class HeaderNavigation(Navigation):
'create_letter_branding',
'email_branding',
'find_users_by_email',
'letter_branding',
'live_services',
'organisations',
'platform_admin',
@@ -437,6 +438,7 @@ class MainNavigation(Navigation):
'information_security',
'integration_testing',
'invite_org_user',
'letter_branding',
'live_services',
'manage_org_users',
'new_password',
@@ -623,6 +625,7 @@ class CaseworkNavigation(Navigation):
'integration_testing',
'invite_org_user',
'invite_user',
'letter_branding',
'link_service_to_organisation',
'live_services',
'manage_org_users',
@@ -855,6 +858,7 @@ class OrgNavigation(Navigation):
'information_security',
'integration_testing',
'invite_user',
'letter_branding',
'link_service_to_organisation',
'live_services',
'manage_template_folder',

View File

@@ -1,6 +1,4 @@
{% extends "views/platform-admin/_base_template.html" %}
{% from "components/radios.html" import radios %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/live-search.html" import live_search %}
{% block per_page_title %}

View File

@@ -27,7 +27,7 @@
'Save',
button_name='operation',
button_value='branding-details',
back_link=url_for('main.platform_admin'),
back_link=url_for('main.letter_branding'),
back_link_text='Back to letter branding selection',
) }}
</div>

View File

@@ -0,0 +1,36 @@
{% extends "views/platform-admin/_base_template.html" %}
{% from "components/live-search.html" import live_search %}
{% block per_page_title %}
Letter branding
{% endblock %}
{% block platform_admin_content %}
<div class="grid-row bottom-gutter-2-3">
<div class="column-two-thirds">
<h1 class="heading-large">Letter branding</h1>
</div>
<div class="column-one-third">
<a href="{{ url_for('.create_letter_branding') }}" class="button align-with-heading">Add new brand</a>
</div>
</div>
{{ live_search(target_selector='.letter-brand', show=True, form=search_form) }}
<nav>
{% for brand in letter_brandings %}
<div class="letter-brand">
<div class="message-name">
{{ brand.name }}
</div>
<p class="message-type">
{% if brand.domain %}
Default for {{ brand.domain }}
{% else %}
{% endif %}
</p>
</div>
{% endfor %}
</nav>
{% endblock %}

View File

@@ -18,6 +18,7 @@
('Organisations', url_for('main.organisations')),
('Providers', url_for('main.view_providers')),
('Email branding', url_for('main.email_branding')),
('Letter branding', url_for('main.letter_branding')),
('Inbound SMS numbers', url_for('main.inbound_sms_admin')),
('Find users by email', url_for('main.find_users_by_email')),
('Email Complaints', url_for('main.platform_admin_list_complaints')),