Change organisations to email branding

This commit is contained in:
chrisw
2018-02-07 10:30:49 +00:00
parent a819b30d35
commit 9ad4435d94
24 changed files with 736 additions and 594 deletions

View File

@@ -57,3 +57,29 @@
{% endif %}
</div>
{% endmacro %}
{% macro colour_textbox(
field,
width='2-3',
colour='#FFFFFF'
) %}
<div class="form-group{% if field.errors %} form-group-error{% endif %}">
<label class="form-label" for="{{ field.name }}">
{{ field.label.text }}
{% if field.errors %}
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
{{ field.errors[0] }}
</span>
{% endif %}
</label>
{% set field_class = 'form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else '') %}
{% set field_class = 'form-control ' + field_class + (' form-control-error' if field.errors else '') %}
{{ field(
class=field_class,
data_module='',
rows='1',
**kwargs
) }}
<span class="textbox-colour-preview" style="background:{{ colour }}"></span>
</div>
{% endmacro %}

View File

@@ -0,0 +1,45 @@
{% extends "views/platform-admin/_base_template.html" %}
{% from "components/file-upload.html" import file_upload %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox, colour_textbox %}
{% block service_page_title %}
{{ '{} email branding'.format('Update' if email_branding else 'Create')}}
{% endblock %}
{% block platform_admin_content %}
<h1 class="heading-large">{{ '{} email branding'.format('Update' if email_branding else 'Create')}}</h1>
<div class="grid-row">
<div class="column-three-quarters">
{% if logo %}
<div id="logo-img">
<img src="https://{{ cdn_url }}/{{ logo }}"/>
</div>
{% endif %}
{{ file_upload(form.file, button_text='{} logo'.format('Update' if email_branding else 'Upload')) }}
<form method="post">
<div class="form-group">
<div style='margin-top:15px;'>{{textbox(form.name)}}</div>
{{colour_textbox(form.colour, width='1-4', colour=email_branding.colour if email_branding)}}
{{ page_footer(
'Save',
back_link=url_for('.email_branding'),
back_link_text='Back to email branding selection',
) }}
</div>
</form>
</div>
</div>
<script type="text/javascript">
function update_colour(element){
colour_preview = document.getElementsByClassName("textbox-colour-preview")[0];
if (element.value.match(/^#[0-9A-F]{6}$/i)) {
colour_preview.style.background = element.value;
} else {
colour_preview.style.background = '#FFFFFF';
}
}
</script>
{% endblock %}

View File

@@ -3,19 +3,19 @@
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Select organisation
Select email branding
{% endblock %}
{% block platform_admin_content %}
<h1 class="heading-large">
<div>Select an organisation to update</div>
<div>or create a new organisation</div>
<div>Select an email branding to update</div>
<div>or create a new email branding</div>
</h1>
<div class="grid-row">
<div class="column-three-quarters">
<form method="post">
{{ branding_radios(form.organisation, branding_dict=branding_dict, show_header=False) }}
{{ branding_radios(form.email_branding, branding_dict=branding_dict, show_header=False) }}
{{ page_footer(
'Next'
) }}

View File

@@ -1,54 +0,0 @@
{% extends "views/platform-admin/_base_template.html" %}
{% from "components/file-upload.html" import file_upload %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/textbox.html" import textbox %}
{% block service_page_title %}
{{ '{} an organisations logo'.format('Update' if organisation else 'Create')}}
{% endblock %}
{% block platform_admin_content %}
<h1 class="heading-large">{{ '{} an organisations logo'.format('Update' if organisation else 'Create')}}</h1>
<div class="grid-row">
<div class="column-three-quarters">
{% if logo %}
<div id="logo-img">
<img src="https://{{ cdn_url }}/{{ logo }}"/>
</div>
{% endif %}
{{
file_upload(
form.file,
button_text='{} logo'.format('Update' if organisation else 'Upload')
) }}
<form method="post">
<div class="form-group">
<div style='margin-top:15px;'>{{textbox(form.name)}}</div>
<div>{{textbox(form.colour, width='1-4')}}
<span id='colour_span' style="background: {{ organisation.colour }}; {% if not organisation.colour %}visibility:hidden; {% endif %}border:1px black solid; width: 3px; height: 25px;position:absolute;margin-top:138px;margin-left:135px;display:block;"></span>
</div>
{{ page_footer(
'Save',
back_link=url_for('.organisations', organisation_id=organisation.id if organisation else 'None'),
back_link_text='Back to organisation selection',
) }}
</div>
</form>
</div>
</div>
<script type="text/javascript">
function update_colour_span() {
document.getElementById('colour_span').style.background = '';
if (document.getElementById('colour').value) {
document.getElementById('colour_span').style.visibility = 'visible';
document.getElementById('colour_span').style.background = document.getElementById('colour').value;
}
else {
document.getElementById('colour_span').style.visibility = 'hidden';
}
}
</script>
{% endblock %}

View File

@@ -16,7 +16,7 @@
('Live services', url_for('main.live_services')),
('Trial mode services', url_for('main.trial_services')),
('Providers', url_for('main.view_providers')),
('Organisations', url_for('main.organisations')),
('Email branding', url_for('main.email_branding')),
('Letter jobs', url_for('main.letter_jobs')),
('Inbound SMS numbers', url_for('main.inbound_sms_admin'))
] %}

View File

@@ -211,14 +211,14 @@
{% if current_service.branding == 'govuk' %}
GOV.UK
{% elif current_service.branding == 'both' %}
GOV.UK and {{ organisation.name if organisation else None }}
GOV.UK and {{ email_branding.name if email_branding else None }}
{% elif current_service.branding == 'org' %}
Only {{ organisation.name if organisation else None }}
Only {{ email_branding.name if email_branding else None }}
{% elif current_service.branding == 'org_banner' %}
Only {{ organisation.name if organisation else None }} banner
Only {{ email_branding.name if email_branding else None }} banner
{% endif %}
{% endcall %}
{{ edit_field('Change', url_for('.service_set_branding_and_org', service_id=current_service.id)) }}
{{ edit_field('Change', url_for('.service_set_email_branding', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Letter branding')}}

View File

@@ -3,7 +3,7 @@
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Set branding and organisation
Set email branding
{% endblock %}
{% block maincolumn_content %}
@@ -13,7 +13,7 @@
<div class="column-three-quarters">
<form method="post">
{{ radios(form.branding_type) }}
{{ branding_radios(form.organisation, branding_dict=branding_dict) }}
{{ branding_radios(form.branding_style, branding_dict=branding_dict) }}
{{ page_footer(
'Save',
back_link=url_for('.service_settings', service_id=current_service.id),