mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 08:44:23 -04:00
Add view for a single template
> At the moment, we have an all email templates page, and an edit an > individual page. > > This gets messy when we refer to templates like the dashboard and the > activity views. We solve this currently by using anchor links to the > list page, but this is clunky. > > So lets add it, then update the links on the dash and activity to the > new view page. > > Should be a link from the view a single template page, to the template > hub page. https://www.pivotaltracker.com/story/show/117349227
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/email-message.html" import email_message %}
|
||||
{% from "components/sms-message.html" import sms_message %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ page_heading }} – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{% if not templates %}
|
||||
|
||||
<h1 class="heading-large">{{ page_heading }}</h1>
|
||||
|
||||
{% if current_user.has_permissions(permissions=['manage_templates'], any_=True) %}
|
||||
<p class="bottom-gutter">
|
||||
There are no
|
||||
{{ 'email' if 'email' == template_type else 'text message' }}
|
||||
templates
|
||||
</p>
|
||||
<a href="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}" 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>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
<h1 class="heading-large">{{ page_heading }}</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>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="grid-row">
|
||||
{% for template in templates %}
|
||||
<div class="column-two-thirds">
|
||||
{% if 'email' == template_type %}
|
||||
{{ email_message(
|
||||
None,
|
||||
template.formatted_as_markup,
|
||||
name=template.name,
|
||||
) }}
|
||||
{% elif 'sms' == template_type %}
|
||||
{{ sms_message(
|
||||
template.formatted_as_markup,
|
||||
name=template.name
|
||||
) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
<div class="sms-message-use-links">
|
||||
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
|
||||
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}">Send from a CSV file</a>
|
||||
<a href="{{ url_for(".send_message_to_self", service_id=current_service.id, template_id=template.id) }}">Send yourself a test</a>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions(permissions=['manage_api_keys']) %}
|
||||
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API integration</a>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
|
||||
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -6,7 +6,7 @@
|
||||
field_headings=['Template', hidden_field_heading('Type'), right_aligned_field_heading('Messages sent')]
|
||||
) %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for('.edit_service_template', service_id=current_service.id, template_id=item.template.id) }}">
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">
|
||||
{{ item.template.name }}
|
||||
</a>
|
||||
{% endcall %}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, status=['delivered'], page=1) }}">Successful messages</a> 
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, status=['failed'], page=1) }}">Failed messages</a>
|
||||
</p>
|
||||
|
||||
{% call(item, row_number) list_table(
|
||||
notifications,
|
||||
caption="Recent activity",
|
||||
@@ -31,7 +32,7 @@
|
||||
{{ item.to }}
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for(".choose_template", service_id=current_service.id, template_type=item.template.template_type, _anchor=item.template.name|linkable_name) }}">{{ item.template.name }}</a>
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">{{ item.template.name }}</a>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{{ item.template.template_type }}
|
||||
|
||||
31
app/templates/views/templates/_template.html
Normal file
31
app/templates/views/templates/_template.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% from "components/email-message.html" import email_message %}
|
||||
{% from "components/sms-message.html" import sms_message %}
|
||||
|
||||
<div class="column-two-thirds">
|
||||
{% if 'email' == template.template_type %}
|
||||
{{ email_message(
|
||||
None,
|
||||
template.formatted_as_markup,
|
||||
name=template.name if show_title else None
|
||||
) }}
|
||||
{% elif 'sms' == template.template_type %}
|
||||
{{ sms_message(
|
||||
template.formatted_as_markup,
|
||||
name=template.name if show_title else None
|
||||
) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
<div class="sms-message-use-links{% if show_title %}-with-title{% endif %}">
|
||||
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
|
||||
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}">Send from a CSV file</a>
|
||||
<a href="{{ url_for(".send_message_to_self", service_id=current_service.id, template_id=template.id) }}">Send yourself a test</a>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions(permissions=['manage_api_keys']) %}
|
||||
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API integration</a>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
|
||||
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
45
app/templates/views/templates/choose.html
Normal file
45
app/templates/views/templates/choose.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ page_heading }} – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{% if not templates %}
|
||||
|
||||
<h1 class="heading-large">{{ page_heading }}</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' }}
|
||||
</p>
|
||||
<a href="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}" 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>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
<h1 class="heading-large">{{ page_heading }}</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>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="grid-row">
|
||||
{% for template in templates %}
|
||||
{% with show_title=True %}
|
||||
{% include 'views/templates/_template.html' %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
28
app/templates/views/templates/template.html
Normal file
28
app/templates/views/templates/template.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/email-message.html" import email_message %}
|
||||
{% from "components/sms-message.html" import sms_message %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ template.name }} – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
|
||||
<h1 class="heading-large">{{ template.name }}</h1>
|
||||
|
||||
<div class="grid-row">
|
||||
{% include 'views/templates/_template.html' %}
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<a href="{{ url_for('.choose_template', service_id=current_service.id, template_type=template.template_type) }}">
|
||||
All
|
||||
{{ 'email' if 'email' == template.template_type else 'text message' }}
|
||||
templates
|
||||
</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user