Add a page to set organisation and branding option

Platform admin only.

Adds radio buttons to choose one of:
- three hard-coded branding options
- organisations from a list provided by the API
This commit is contained in:
Chris Hill-Scott
2016-08-08 10:28:40 +01:00
committed by Leo Hemsted
parent 20c39d24b7
commit 6b5e64479a
10 changed files with 249 additions and 6 deletions

View File

@@ -21,3 +21,43 @@
</fieldset>
</div>
{% endmacro %}
{% macro branding_radios(
field,
hint=None,
branding_dict={}
) %}
<div class="form-group {% if field.errors %} error{% endif %}">
<fieldset>
<legend class="form-label">
{{ field.label }}
{% if field.errors %}
<span class="error-message">
{{ field.errors[0] }}
</span>
{% endif %}
</legend>
{% for value, option, checked in field.iter_choices() %}
<label class="block-label" for="{{ field.name }}-{{ loop.index }}">
<input
type="radio"
name="{{ field.name }}"
id="{{ field.name }}-{{ loop.index }}"
{% if checked %}checked="checked"{% endif %}
/>
{% if branding_dict.get(value, {}).get('colour') %}
<span style="background: {{ branding_dict[value].colour }}; display: inline-block; width: 3px; height: 27px"></span>
{% endif %}
{% if branding_dict.get(value, {}).get('logo') %}
<img
src="{{ branding_dict[value].logo }}"
height="27"
/>
{% endif %}
{{option}}
</label>
{% endfor %}
</fieldset>
</div>
{% endmacro %}

View File

@@ -18,6 +18,10 @@
'title': 'Set email reply to address',
'link': url_for('.service_set_reply_to_email', service_id=current_service.id)
},
{
'title': 'Set email branding',
'link': url_for('.service_set_branding_and_org', service_id=current_service.id)
} if current_user.has_permissions([], admin_override=True) else {},
{
'title': 'Set text message sender name',
'link': url_for('.service_set_sms_sender', service_id=current_service.id)
@@ -51,7 +55,7 @@
'title': 'Take service out of research mode',
'link': url_for('.service_switch_research_mode', service_id=current_service.id)
} if current_service.research_mode and current_user.has_permissions([], admin_override=True) else {
},
}
]) }}
{% endblock %}

View File

@@ -0,0 +1,25 @@
{% extends "withnav_template.html" %}
{% from "components/radios.html" import radios, branding_radios %}
{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
Set branding and organisation GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Set email branding</h1>
<div class="grid-row">
<div class="column-three-quarters">
<form method="post">
{{ radios(form.branding_type) }}
{{ branding_radios(form.organisation, branding_dict=branding_dict) }}
{{ page_footer(
'Save',
back_link=url_for('.service_settings', service_id=current_service.id)
) }}
</form>
</div>
</div>
{% endblock %}