Merge branch 'master' into refactor-s3-upload

Conflicts:
	requirements.txt
This commit is contained in:
Rebecca Law
2017-04-10 11:44:56 +01:00
13 changed files with 128 additions and 91 deletions

View File

@@ -279,12 +279,15 @@ def format_date_short(date):
def format_delta(date):
delta = (
datetime.now(timezone.utc)
) - (
gmt_timezones(date)
)
if delta < timedelta(seconds=30):
return "just now"
return ago.human(
(
datetime.now(timezone.utc)
) - (
dateutil.parser.parse(date)
),
delta,
future_tense='{} from now', # No-one should ever see this
past_tense='{} ago',
precision=1

View File

@@ -77,7 +77,6 @@ def get_example_letter_address(key):
return {
'address line 1': 'A. Name',
'address line 2': '123 Example Street',
'address line 3': 'Example town',
'postcode': 'XM4 5HQ'
}.get(key, '')
@@ -237,13 +236,13 @@ def _check_messages(service_id, template_type, upload_id, letters_as_pdf=False):
if request.args.get('from_test'):
extra_args = {'help': 1} if request.args.get('help', '0') != '0' else {}
if len(template.placeholders):
if len(template.placeholders) or template.template_type == 'letter':
back_link = url_for(
'.send_test', service_id=service_id, template_id=template.id, **extra_args
)
else:
back_link = url_for(
'.choose_template', service_id=service_id, **extra_args
'.view_template', service_id=service_id, template_id=template.id, **extra_args
)
choose_time_form = None
else:

View File

@@ -287,13 +287,17 @@ def edit_service_template(service_id, template_id):
}, current_service)
template_change = get_template(template, current_service).compare_to(new_template)
if template_change.has_different_placeholders and not request.form.get('confirm'):
example_column_headings = (
first_column_headings[new_template.template_type] +
list(new_template.placeholders)
)
return render_template(
'views/templates/breaking-change.html',
template_change=template_change,
new_template=new_template,
column_headings=list(ascii_uppercase[:len(new_template.placeholders) + 1]),
column_headings=list(ascii_uppercase[:len(example_column_headings)]),
example_rows=[
first_column_headings[new_template.template_type] + list(new_template.placeholders),
example_column_headings,
get_example_csv_rows(new_template),
get_example_csv_rows(new_template)
],

View File

@@ -12,6 +12,8 @@ class JobApiClient(NotifyAdminAPIClient):
'finished',
'cancelled',
'sending limits exceeded',
'ready to send',
'sent to dvla'
}
def __init__(self):

View File

@@ -37,7 +37,7 @@
<h2 class="heading-medium">May 2017</h2>
<ul class="list list-bullet">
<li>Supporting replies to text messages (invite only)</li>
<li>Retiring version of the API</li>
<li>Retiring version 1 of the API</li>
<li>Sending individual messages via Notify interface</li>
<li>Restricting notifications to sociable hours</li>
<li>Searching for notifications by phone number or email address</li>

View File

@@ -117,12 +117,12 @@
<div class="grid-row bottom-gutter">
<div class="column-half">
<h3 class="visually-hidden">Services</h3>
<div class="product-page-big-number">43</div>
<div class="product-page-big-number">44</div>
services
</div>
<div class="column-half">
<h3 class="visually-hidden">Departments</h3>
<div class="product-page-big-number">25</div>
<div class="product-page-big-number">26</div>
departments
</div>
</div>

View File

@@ -41,8 +41,8 @@
<p>
When you send messages using this template youll need
{{ new_template.placeholders|length + 1 }}
column{{ 's' if new_template.placeholders|length > 0 else '' }} of data:
{{ column_headings|length }}
column{{ 's' if column_headings|length > 1 else '' }} of data:
</p>
<div class="spreadsheet">

View File

@@ -24,7 +24,7 @@
{% if template._template.updated_at %}
<div class="bottom-gutter-2">
<h2 class="heading-small">Last edited {{ template._template.updated_at|format_datetime_relative }}</h2>
<h2 class="heading-small">Last edited {{ template._template.updated_at|format_delta }}</h2>
<p>
<a href="{{ url_for('.view_template_versions', service_id=current_service.id, template_id=template.id) }}">See previous versions</a>
</p>