Merge pull request #568 from alphagov/template_history_view

Template history view
This commit is contained in:
Rebecca Law
2016-05-17 08:50:40 +01:00
13 changed files with 296 additions and 16 deletions

View File

@@ -15,6 +15,7 @@
{% else %}
{{ name }}
{% endif %}
{% if created_at %}{{ created_at }}{% endif %}
</h3>
{% endif %}
<div class="email-message">

View File

@@ -14,6 +14,7 @@
{% else %}
{{ name }}
{% endif %}
{% if created_at %}{{ created_at }}{% endif %}
</h3>
{% endif %}
{% if recipient is not none %}

View File

@@ -81,7 +81,7 @@
{{ item.to }}
</p>
<p class="hint">
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">{{ item.template.name }}</a>
<a href="{{ url_for('.view_template_version', service_id=current_service.id, template_id=item.template.id, version=item.template_version) }}">{{ item.template.name }}</a>
sent from
{% if item.job %}
<a href="{{ url_for(".view_job", service_id=current_service.id, job_id=item.job.id) }}">{{ item.job.original_file_name }}</a>

View File

@@ -25,6 +25,7 @@
{% 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 %}
<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">Template versions</a>
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API info</a>
</div>
</div>

View File

@@ -0,0 +1,40 @@
{% 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(
template.formatted_subject_as_markup,
template.formatted_as_markup,
name=template.name if show_title else None,
edit_link=url_for(
'.view_template_version',
service_id=current_service.id,
template_id=template.id,
version=template.get_raw('version')
)
) }}
{% elif 'sms' == template.template_type %}
{{ sms_message(
template.formatted_as_markup,
name=template.name if show_title else None,
edit_link=url_for(
'.view_template_version',
service_id=current_service.id,
template_id=template.id,
version=template.get_raw('version')
)
) }}
{% endif %}
</div>
<div class="column-one-third">
<div class="sms-message-use-links{% if show_title %}-with-title{% endif %}">
<p>Edited by {{ template.get_raw('created_by').name }}</p>
<p>Created on {{ template.get_raw('created_at')|format_datetime }}</p>
<p>Edited on
{% if template.get_raw('updated_at') %}
{{ template.get_raw('updated_at')|format_datetime }}</p>
{% endif %}
</div>
</div>

View File

@@ -0,0 +1,16 @@
{% extends "withnav_template.html" %}
{% block page_title %}
{{ template.name }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">{{ template.name }} version history</h1>
<div class="grid-row">
{% for template in versions %}
{% with show_title=True %}
{% include 'views/templates/_template_history.html' %}
{% endwith %}
{% endfor %}
</div>
{% endblock %}

View File

@@ -0,0 +1,22 @@
{% 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">
{% with show_title=False %}
{% include 'views/templates/_template_history.html' %}
{% endwith %}
</div>
{% endblock %}