mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Show letter branding preview when selecting a brand
This adds a preview pane which is visible when updating a letter brand. If JavaScript is enabled, the preview pane shows on the set-letter-branding page, and submitting the form saves updates the letter brand for a service immediately. If Javascript is not enabled, there is a separate 'Preview email branding' page which shows a preview of the brand and has a 'Save' button on it.
This commit is contained in:
@@ -24,6 +24,21 @@ class TemplatePreview:
|
||||
)
|
||||
return (resp.content, resp.status_code, resp.headers.items())
|
||||
|
||||
@classmethod
|
||||
def from_example_template(cls, template, filename):
|
||||
data = {
|
||||
'letter_contact_block': template.get('reply_to_text'),
|
||||
'template': template,
|
||||
'values': None,
|
||||
'filename': filename
|
||||
}
|
||||
resp = requests.post(
|
||||
'{}/preview.png'.format(current_app.config['TEMPLATE_PREVIEW_API_HOST']),
|
||||
json=data,
|
||||
headers={'Authorization': 'Token {}'.format(current_app.config['TEMPLATE_PREVIEW_API_KEY'])}
|
||||
)
|
||||
return (resp.content, resp.status_code, resp.headers.items())
|
||||
|
||||
@classmethod
|
||||
def from_utils_template(cls, template, filetype, page=None):
|
||||
return cls.from_database_object(
|
||||
|
||||
Reference in New Issue
Block a user