Merge pull request #1163 from alphagov/unified-template-page

Merge email, text message and letter templates pages
This commit is contained in:
Chris Hill-Scott
2017-03-06 10:42:08 +00:00
committed by GitHub
15 changed files with 168 additions and 143 deletions

View File

@@ -45,11 +45,7 @@
<ul>
<li><a href="{{ url_for('.service_dashboard', service_id=current_service.id) }}">Dashboard</a></li>
{% if current_user.has_permissions(['view_activity', 'manage_templates', 'manage_api_keys'], admin_override=True, any_=True) %}
<li><a href="{{ url_for('.choose_template', service_id=current_service.id, template_type='email') }}">Email templates</a></li>
<li><a href="{{ url_for('.choose_template', service_id=current_service.id, template_type='sms') }}">Text message templates</a></li>
{% if current_service.can_send_letters %}
<li><a href="{{ url_for('.choose_template', service_id=current_service.id, template_type='letter') }}">Letter templates</a></li>
{% endif %}
<li><a href="{{ url_for('.choose_template', service_id=current_service.id) }}">Templates</a></li>
{% endif %}
{% if current_user.has_permissions(['manage_users', 'manage_settings'], admin_override=True) %}
<li><a href="{{ url_for('.manage_users', service_id=current_service.id) }}">Team members</a></li>

View File

@@ -1,10 +1,11 @@
<h2 class="heading-medium">Get started</h2>
<nav class="grid-row">
<div class="column-half">
<a class="pill-separate-item" href="{{ url_for('.choose_template', service_id=current_service.id, template_type='email') }}">Write an email</a>
</div>
<div class="column-half">
<a class="pill-separate-item" href="{{ url_for('.choose_template', service_id=current_service.id, template_type='sms') }}">Write a text message</a>
</div>
<nav>
<a class="pill-separate-item" href="{{ url_for('.choose_template', service_id=current_service.id) }}">
{% if current_service.can_send_letters %}
Write an email, text message or letter
{% else %}
Write an email or text message
{% endif %}
</a>
</nav>

View File

@@ -0,0 +1,21 @@
{% from "components/radios.html" import radios %}
{% from "components/page-footer.html" import page_footer %}
{% extends "withnav_template.html" %}
{% block service_page_title %}
Add new template
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Add new template</h1>
<form method="post">
{{ radios(form.template_type) }}
{{ page_footer(
'Next'
) }}
</form>
{% endblock %}

View File

@@ -1,34 +1,45 @@
{% extends "withnav_template.html" %}
{% block service_page_title %}
{{ page_heading }}
Templates
{% endblock %}
{% block maincolumn_content %}
{% if not templates %}
<h1 class="heading-large">{{ page_heading }}</h1>
<h1 class="heading-large">Templates</h1>
{% if current_user.has_permissions(permissions=['manage_templates'], any_=True) %}
<p class="bottom-gutter">
You need a template before you can send
{{ 'emails' if 'email' == template_type else 'text messages' }}
{% if current_service.can_send_letters %}
emails, text messages or letters
{%- else -%}
emails or text messages
{%- endif %}.
</p>
<a href="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}" class="button">Add a new template</a>
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id) }}" class="button">Add a new template</a>
{% else %}
<p>You need to ask your service manager to add templates before you can send messages</p>
<p>
You need to ask your service manager to add templates before you can send
{% if current_service.can_send_letters %}
emails, text messages or letters
{%- else -%}
emails or text messages
{%- endif %}.
</p>
{% endif %}
{% else %}
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-large">{{ page_heading }}</h1>
<h1 class="heading-large">Templates</h1>
</div>
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
<div class="column-one-third">
<a href="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}" class="button align-with-heading">Add new template</a>
<a href="{{ url_for('.add_template_by_type', service_id=current_service.id) }}" class="button align-with-heading">Add new template</a>
</div>
{% endif %}
</div>

View File

@@ -14,6 +14,6 @@
{% endfor %}
</div>
<p>
<a href="{{ url_for(".choose_template", service_id=current_service.id, template_type=versions[0].template_type) }}">Back to current templates</a>
<a href="{{ url_for(".choose_template", service_id=current_service.id) }}">Back to current templates</a>
</p>
{% endblock %}

View File

@@ -18,10 +18,8 @@
</div>
{{ page_footer(
secondary_link=url_for('.choose_template', service_id=current_service.id, template_type=template.template_type),
secondary_link_text='All {} templates'.format(
'email' if 'email' == template.template_type else 'text message' if 'sms' == template.template_type else 'letter'
)
secondary_link=url_for('.choose_template', service_id=current_service.id),
secondary_link_text='All templates'
) }}
{% endblock %}