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: