mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-04 09:08:26 -04:00
Merge pull request #595 from alphagov/template_versions_link_design
Beautify the template version links and template link page.
This commit is contained in:
@@ -101,12 +101,14 @@ def create_app():
|
|||||||
|
|
||||||
application.add_template_filter(nl2br)
|
application.add_template_filter(nl2br)
|
||||||
application.add_template_filter(format_datetime)
|
application.add_template_filter(format_datetime)
|
||||||
|
application.add_template_filter(format_datetime_normal)
|
||||||
application.add_template_filter(format_datetime_short)
|
application.add_template_filter(format_datetime_short)
|
||||||
application.add_template_filter(format_time)
|
application.add_template_filter(format_time)
|
||||||
application.add_template_filter(syntax_highlight_json)
|
application.add_template_filter(syntax_highlight_json)
|
||||||
application.add_template_filter(valid_phone_number)
|
application.add_template_filter(valid_phone_number)
|
||||||
application.add_template_filter(linkable_name)
|
application.add_template_filter(linkable_name)
|
||||||
application.add_template_filter(format_date)
|
application.add_template_filter(format_date)
|
||||||
|
application.add_template_filter(format_date_normal)
|
||||||
application.add_template_filter(format_date_short)
|
application.add_template_filter(format_date_short)
|
||||||
application.add_template_filter(format_notification_status)
|
application.add_template_filter(format_notification_status)
|
||||||
|
|
||||||
@@ -195,6 +197,10 @@ def format_datetime(date):
|
|||||||
return gmt_timezones(date).strftime('%A %d %B %Y at %H:%M')
|
return gmt_timezones(date).strftime('%A %d %B %Y at %H:%M')
|
||||||
|
|
||||||
|
|
||||||
|
def format_datetime_normal(date):
|
||||||
|
return gmt_timezones(date).strftime('%d %B %Y at %H:%M')
|
||||||
|
|
||||||
|
|
||||||
def format_datetime_short(date):
|
def format_datetime_short(date):
|
||||||
return gmt_timezones(date).strftime('%d %B at %H:%M')
|
return gmt_timezones(date).strftime('%d %B at %H:%M')
|
||||||
|
|
||||||
@@ -207,6 +213,10 @@ def format_date(date):
|
|||||||
return gmt_timezones(date).strftime('%A %d %B %Y')
|
return gmt_timezones(date).strftime('%A %d %B %Y')
|
||||||
|
|
||||||
|
|
||||||
|
def format_date_normal(date):
|
||||||
|
return gmt_timezones(date).strftime('%d %B %Y')
|
||||||
|
|
||||||
|
|
||||||
def format_date_short(date):
|
def format_date_short(date):
|
||||||
return gmt_timezones(date).strftime('%d %B').lstrip('0')
|
return gmt_timezones(date).strftime('%d %B').lstrip('0')
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,13 @@ $button-bottom-border-colour: rgba(0, 0, 0, 0.17);
|
|||||||
|
|
||||||
&-name {
|
&-name {
|
||||||
@include bold-24;
|
@include bold-24;
|
||||||
margin: 20px 0 10px 0;
|
margin: 20px 0 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-updated-at {
|
||||||
|
@include copy-16;
|
||||||
|
color: $secondary-text-colour;
|
||||||
|
margin: 0 0 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-meta {
|
&-meta {
|
||||||
|
|||||||
@@ -36,7 +36,24 @@
|
|||||||
|
|
||||||
.sms-message-name {
|
.sms-message-name {
|
||||||
@include bold-24;
|
@include bold-24;
|
||||||
margin: 20px 0 10px 0;
|
margin: 20px 0 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sms-message-updated-at {
|
||||||
|
@include copy-16;
|
||||||
|
color: $secondary-text-colour;
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sms-message-use-links-history {
|
||||||
|
@include copy-16;
|
||||||
|
color: $secondary-text-colour;
|
||||||
|
margin: 45px 0 0 0;
|
||||||
|
|
||||||
|
.primary {
|
||||||
|
color: $text-colour;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sms-message-picker {
|
.sms-message-picker {
|
||||||
@@ -52,7 +69,7 @@
|
|||||||
.sms-message-use-links {
|
.sms-message-use-links {
|
||||||
|
|
||||||
@include copy-19;
|
@include copy-19;
|
||||||
margin-top: -5px;
|
margin-top: 35px;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -73,7 +90,7 @@
|
|||||||
|
|
||||||
.sms-message-use-links-with-title {
|
.sms-message-use-links-with-title {
|
||||||
@extend %sms-message-use-links;
|
@extend %sms-message-use-links;
|
||||||
margin-top: 55px;
|
margin-top: 95px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sms-message-from {
|
.sms-message-from {
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ def get_example_csv_rows(template, use_example_as_example=True, submitted_fields
|
|||||||
def choose_template(service_id, template_type):
|
def choose_template(service_id, template_type):
|
||||||
if template_type not in ['email', 'sms']:
|
if template_type not in ['email', 'sms']:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/templates/choose.html',
|
'views/templates/choose.html',
|
||||||
templates=[
|
templates=[
|
||||||
|
|||||||
@@ -6,7 +6,13 @@
|
|||||||
from_name=None,
|
from_name=None,
|
||||||
from_address=None,
|
from_address=None,
|
||||||
recipient=None,
|
recipient=None,
|
||||||
show_placeholder_for_recipient=False
|
id=None,
|
||||||
|
created_at=None,
|
||||||
|
updated_at=None,
|
||||||
|
versions_url=None,
|
||||||
|
version=1,
|
||||||
|
show_placeholder_for_recipient=False,
|
||||||
|
show_id=False
|
||||||
) %}
|
) %}
|
||||||
{% if name %}
|
{% if name %}
|
||||||
<h3 class="email-message-name">
|
<h3 class="email-message-name">
|
||||||
@@ -15,9 +21,17 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{{ name }}
|
{{ name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if created_at %}{{ created_at }}{% endif %}
|
|
||||||
</h3>
|
</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if version > 1 %}
|
||||||
|
{% if updated_at %}
|
||||||
|
<p class="email-message-updated-at">Last updated on {{ updated_at|format_date_normal }} <a href="{{ versions_url }}">see earlier versions</a></p>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if created_at %}
|
||||||
|
<p class="email-message-updated-at">Created on {{ created_at|format_date_normal }}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
<div class="email-message">
|
<div class="email-message">
|
||||||
{% if from_name or subject %}
|
{% if from_name or subject %}
|
||||||
<table class="email-message-meta">
|
<table class="email-message-meta">
|
||||||
|
|||||||
@@ -5,7 +5,12 @@
|
|||||||
id=None,
|
id=None,
|
||||||
edit_link=None,
|
edit_link=None,
|
||||||
from=None,
|
from=None,
|
||||||
show_placeholder_for_recipient=False
|
version=1,
|
||||||
|
created_at=None,
|
||||||
|
updated_at=None,
|
||||||
|
versions_url=None,
|
||||||
|
show_placeholder_for_recipient=False,
|
||||||
|
show_id=False
|
||||||
) %}
|
) %}
|
||||||
{% if name %}
|
{% if name %}
|
||||||
<h3 class="sms-message-name">
|
<h3 class="sms-message-name">
|
||||||
@@ -14,9 +19,17 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{{ name }}
|
{{ name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if created_at %}{{ created_at }}{% endif %}
|
|
||||||
</h3>
|
</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if version > 1 %}
|
||||||
|
{% if updated_at %}
|
||||||
|
<p class="sms-message-updated-at">Last updated on {{ updated_at|format_date_normal }} <a href="{{ versions_url }}">see earlier versions</a></p>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if created_at %}
|
||||||
|
<p class="sms-message-updated-at">Created on {{ created_at|format_date_normal }}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if recipient is not none %}
|
{% if recipient is not none %}
|
||||||
<p class="sms-message-recipient">
|
<p class="sms-message-recipient">
|
||||||
To:
|
To:
|
||||||
@@ -37,7 +50,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{{ body|nl2br }}
|
{{ body|nl2br }}
|
||||||
</div>
|
</div>
|
||||||
{% if id %}
|
{% if show_id %}
|
||||||
<p class="sms-message-recipient">
|
<p class="sms-message-recipient">
|
||||||
Template ID: {{ id }}
|
Template ID: {{ id }}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -2,16 +2,27 @@
|
|||||||
{% from "components/sms-message.html" import sms_message %}
|
{% from "components/sms-message.html" import sms_message %}
|
||||||
|
|
||||||
<div class="column-two-thirds">
|
<div class="column-two-thirds">
|
||||||
|
{{ template.versions }}
|
||||||
{% if 'email' == template.template_type %}
|
{% if 'email' == template.template_type %}
|
||||||
{{ email_message(
|
{{ email_message(
|
||||||
template.formatted_subject_as_markup,
|
template.formatted_subject_as_markup,
|
||||||
template.formatted_as_markup,
|
template.formatted_as_markup,
|
||||||
name=template.name if show_title else None
|
name=template.name if show_title else None,
|
||||||
|
id=template.id,
|
||||||
|
created_at=template.get_raw('created_at', None),
|
||||||
|
updated_at=template.get_raw('updated_at', None),
|
||||||
|
version=template.get_raw('version', 1),
|
||||||
|
versions_url=url_for('.view_template_versions', service_id=current_service.id, template_id=template.id)
|
||||||
) }}
|
) }}
|
||||||
{% elif 'sms' == template.template_type %}
|
{% elif 'sms' == template.template_type %}
|
||||||
{{ sms_message(
|
{{ sms_message(
|
||||||
template.formatted_as_markup,
|
template.formatted_as_markup,
|
||||||
name=template.name if show_title else None
|
name=template.name if show_title else None,
|
||||||
|
id=template.id,
|
||||||
|
created_at=template.get_raw('created_at', None),
|
||||||
|
updated_at=template.get_raw('updated_at', None),
|
||||||
|
version=template.get_raw('version', 1),
|
||||||
|
versions_url=url_for('.view_template_versions', service_id=current_service.id, template_id=template.id)
|
||||||
) }}
|
) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +36,6 @@
|
|||||||
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
|
{% 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>
|
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
|
||||||
{% endif %}
|
{% 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>
|
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API info</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -29,12 +29,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column-one-third">
|
<div class="column-one-third">
|
||||||
<div class="sms-message-use-links{% if show_title %}-with-title{% endif %}">
|
<div class="sms-message-use-links-history">
|
||||||
<p>Edited by {{ template.get_raw('created_by').name }}</p>
|
<p>
|
||||||
<p>Created on {{ template.get_raw('created_at')|format_datetime }}</p>
|
{% if template.get_raw('version', 1) > 1 %}
|
||||||
<p>Edited on
|
Updated on<br/>{% if template.get_raw('updated_at', None) %}<span class="primary">{{ template.get_raw('updated_at')|format_datetime_normal }}</span>{% endif %}
|
||||||
{% if template.get_raw('updated_at') %}
|
{% else %}
|
||||||
{{ template.get_raw('updated_at')|format_datetime }}</p>
|
Created on<br/>{% if template.get_raw('created_at', None) %}<span class="primary">{{ template.get_raw('created_at')|format_datetime_normal }}</span>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<br/>By {{ template.get_raw('created_by').name }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,14 +54,14 @@ def template_json(service_id,
|
|||||||
type_="sms",
|
type_="sms",
|
||||||
content="template content",
|
content="template content",
|
||||||
subject=None,
|
subject=None,
|
||||||
versions='1'):
|
version=1):
|
||||||
template = {
|
template = {
|
||||||
'id': id_,
|
'id': id_,
|
||||||
'name': name,
|
'name': name,
|
||||||
'template_type': type_,
|
'template_type': type_,
|
||||||
'content': content,
|
'content': content,
|
||||||
'service': service_id,
|
'service': service_id,
|
||||||
'version': versions
|
'version': version
|
||||||
}
|
}
|
||||||
if subject is not None:
|
if subject is not None:
|
||||||
template['subject'] = subject
|
template['subject'] = subject
|
||||||
|
|||||||
Reference in New Issue
Block a user