Merge branch 'master' into add_proxy_header_check

This commit is contained in:
Athanasios Voutsadakis
2017-11-20 10:31:43 +00:00
7 changed files with 80 additions and 35 deletions

View File

@@ -48,6 +48,12 @@ $tail-angle: 20deg;
}
.sms-message-sender {
@include copy-19;
color: $secondary-text-colour;
margin: 0 0 -10px 0;
}
.sms-message-recipient {
@include copy-19;
color: $secondary-text-colour;

View File

@@ -1,3 +1,5 @@
import calendar
from collections import defaultdict
from datetime import datetime
from functools import partial
from flask import (
@@ -115,31 +117,18 @@ def template_usage(service_id):
stats = sorted(stats, key=lambda x: (x['count']), reverse=True)
stats_by_month = list()
for month in get_months_for_financial_year(year, time_format='%Y-%m'):
long_month = yyyy_mm_to_datetime(month).strftime('%B')
template_used = list()
for stat in stats:
if long_month == datetime(1900, stat['month'], 1).strftime("%B"):
template_used.append(
{
'name': stat['name'],
'type': stat['type'],
'requested_count': stat['count']
}
)
stats_by_month.append(
{
'name': long_month,
'templates_used': template_used
}
)
months = stats_by_month
templates_by_month = defaultdict(list)
for stat in stats:
templates_by_month[int(stat['month'])].append({
'name': stat['name'],
'type': stat['type'],
'requested_count': stat['count']
})
months = [{
'name': calendar.month_name[k],
'templates_used': v
} for k, v in templates_by_month.items()
]
return render_template(
'views/dashboard/all-template-statistics.html',

View File

@@ -109,8 +109,7 @@ def service_settings(service_id):
default_sms_sender=default_sms_sender,
sms_sender_count=sms_sender_count,
free_sms_fragment_limit=free_sms_fragment_limit,
prefix_sms_with_service_name=current_service['prefix_sms_with_service_name'],
prefix_sms=current_service['prefix_sms'],
)
@@ -477,7 +476,7 @@ def service_set_sms(service_id):
def service_set_sms_prefix(service_id):
form = SMSPrefixForm(enabled=(
'on' if current_service['prefix_sms_with_service_name'] else 'off'
'on' if current_service['prefix_sms'] else 'off'
))
form.enabled.label.text = 'Start all text messages with {}:'.format(current_service['name'])

View File

@@ -94,7 +94,7 @@
{% call row() %}
{{ text_field('Text messages start with service name') }}
{{ boolean_field(prefix_sms_with_service_name) }}
{{ boolean_field(prefix_sms) }}
{{ edit_field('Change', url_for('.service_set_sms_prefix', service_id=current_service.id)) }}
{% endcall %}

View File

@@ -272,7 +272,7 @@ def get_template(
page_count=1,
redact_missing_personalisation=False,
email_reply_to=None,
sms_sender=None
sms_sender=None,
):
if 'email' == template['template_type']:
return EmailPreviewTemplate(
@@ -288,7 +288,9 @@ def get_template(
return SMSPreviewTemplate(
template,
prefix=service['name'],
sender=not service['prefix_sms_with_service_name'],
show_prefix=service['prefix_sms'],
sender=sms_sender,
show_sender=bool(sms_sender),
show_recipient=show_recipient,
redact_missing_personalisation=redact_missing_personalisation,
)