merge from main

This commit is contained in:
Kenneth Kehl
2023-07-05 15:07:38 -07:00
29 changed files with 442 additions and 354 deletions

View File

@@ -1,5 +1,5 @@
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WX5NGWF');</script>
})(window,document,'script','dataLayer','GTM-WX5NGWF');

View File

@@ -156,17 +156,42 @@ td.table-empty-message {
box-shadow: none;
}
.template-list-item-without-ancestors a.template-list-folder:first-of-type {
background-image: url(../images/folder-blue-bold.svg);
background-size: 30px 30px;
}
.folder-heading a.folder-heading-folder,
.folder-heading-folder,
.template-list-folder {
background-image: none;
padding-left: 0;
text-indent: 0;
background-image: url(../images/folder-blue-bold.svg);
&:hover {
color: color("blue-warm-70v");
background-image: url(../images/folder-blue-bold.svg);
}
}
.template-list-item-without-ancestors a.template-list-folder:first-of-type {
text-indent: 0;
.folder-heading-folder {
background-image: url(../images/folder-black.svg);
}
.folder-heading a.folder-heading-folder-truncated {
background-position: 0;
}
.usa-template-list-template {
background: url(../img/material-icons/description.svg) no-repeat;
padding-left: 40px;
background-size: 30px 30px;
}
.js-enabled .live-search {
display: flex;
margin-bottom: units(2);
.usa-form-group {
@include u-width("mobile-lg");
}
input#search {
width: 100%;
border: 1px solid color("gray-60");
}
}

View File

@@ -1234,15 +1234,7 @@ class BaseTemplateForm(StripWhitespaceForm):
NoCommasInPlaceHolders()
]
)
process_type = GovukRadiosField(
"Use priority queue?",
choices=[
('priority', 'Yes'),
('normal', 'No'),
],
thing='yes or no',
default='normal'
)
process_type = HiddenField('normal')
class SMSTemplateForm(BaseTemplateForm):

View File

@@ -18,7 +18,7 @@ from app.main.views.sub_navigation_dictionaries import (
features_nav,
using_notify_nav,
)
from app.utils import hide_from_search_engines
from app.utils.user import user_is_logged_in
@main.route('/')
@@ -42,11 +42,13 @@ def error(status_code):
@main.route('/privacy')
@user_is_logged_in
def privacy():
return render_template('views/privacy.html')
@main.route('/accessibility-statement')
@user_is_logged_in
def accessibility_statement():
return render_template('views/accessibility_statement.html')
@@ -58,11 +60,13 @@ def delivery_and_failure():
@main.route('/design-patterns-content-guidance')
@user_is_logged_in
def design_content():
return redirect('https://www.gov.uk/service-manual/design/sending-emails-and-text-messages', 301)
@main.route('/_email')
@user_is_logged_in
def email_template():
branding_type = 'govuk'
branding_style = request.args.get('branding_style', None)
@@ -152,6 +156,7 @@ def email_template():
@main.route('/documentation')
@user_is_logged_in
def documentation():
return render_template(
'views/documentation.html',
@@ -172,6 +177,7 @@ def callbacks():
# --- Features page set --- #
@main.route('/features')
@user_is_logged_in
def features():
return render_template(
'views/features.html',
@@ -180,6 +186,7 @@ def features():
@main.route('/features/roadmap', endpoint='roadmap')
@user_is_logged_in
def roadmap():
return render_template(
'views/roadmap.html',
@@ -188,7 +195,7 @@ def roadmap():
@main.route('/features/email')
@hide_from_search_engines
@user_is_logged_in
def features_email():
return render_template(
'views/features/emails.html',
@@ -197,6 +204,7 @@ def features_email():
@main.route('/features/sms')
@user_is_logged_in
def features_sms():
return render_template(
'views/features/text-messages.html',
@@ -205,6 +213,7 @@ def features_sms():
@main.route('/features/security', endpoint='security')
@user_is_logged_in
def security():
return render_template(
'views/security.html',
@@ -213,6 +222,7 @@ def security():
@main.route('/features/terms', endpoint='terms')
@user_is_logged_in
def terms():
return render_template(
'views/terms-of-use.html',
@@ -221,6 +231,7 @@ def terms():
@main.route('/features/using-notify')
@user_is_logged_in
def using_notify():
return render_template(
'views/using-notify.html',
@@ -229,6 +240,7 @@ def using_notify():
@main.route('/using-notify/delivery-status')
@user_is_logged_in
def message_status():
return render_template(
'views/message-status.html',
@@ -237,11 +249,13 @@ def message_status():
@main.route('/features/get-started')
@user_is_logged_in
def get_started_old():
return redirect(url_for('.get_started'), 301)
@main.route('/using-notify/get-started')
@user_is_logged_in
def get_started():
return render_template(
'views/get-started.html',
@@ -269,6 +283,7 @@ def trial_mode_new():
@main.route('/using-notify/guidance')
@user_is_logged_in
def guidance_index():
return render_template(
'views/guidance/index.html',
@@ -277,6 +292,7 @@ def guidance_index():
@main.route('/using-notify/guidance/branding-and-customisation')
@user_is_logged_in
def branding_and_customisation():
return render_template(
'views/guidance/branding-and-customisation.html',
@@ -285,6 +301,7 @@ def branding_and_customisation():
@main.route('/using-notify/guidance/create-and-send-messages')
@user_is_logged_in
def create_and_send_messages():
return render_template(
'views/guidance/create-and-send-messages.html',
@@ -293,6 +310,7 @@ def create_and_send_messages():
@main.route('/using-notify/guidance/edit-and-format-messages')
@user_is_logged_in
def edit_and_format_messages():
return render_template(
'views/guidance/edit-and-format-messages.html',
@@ -301,6 +319,7 @@ def edit_and_format_messages():
@main.route('/using-notify/guidance/send-files-by-email')
@user_is_logged_in
def send_files_by_email():
return render_template(
'views/guidance/send-files-by-email.html',

View File

@@ -275,7 +275,7 @@ def get_status_filters(service, message_type, statistics):
filters = [
# key, label, option
('requested', 'total', 'sending,delivered,failed'),
('sending', 'sending', 'sending'),
('sending', 'pending', 'pending'),
('delivered', 'delivered', 'delivered'),
('failed', 'failed', 'failed'),
]
@@ -320,10 +320,10 @@ def _get_job_counts(job):
],
[
Markup(
f'''sending<span class="usa-sr-only">
f'''pending<span class="usa-sr-only">
{message_count_noun(job.notifications_sending, job_type)}</span>'''
),
'sending',
'pending',
job.notifications_sending
],
[

View File

@@ -7,11 +7,13 @@ from notifications_utils.international_billing_rates import (
from app.main import main
from app.main.forms import SearchByNameForm
from app.main.views.sub_navigation_dictionaries import using_notify_nav
from app.utils.user import user_is_logged_in
CURRENT_SMS_RATE = '1.72'
@main.route('/using-notify/pricing')
@user_is_logged_in
def pricing():
return render_template(
'views/pricing/index.html',
@@ -26,6 +28,7 @@ def pricing():
@main.route('/pricing/how-to-pay')
@user_is_logged_in
def how_to_pay():
return render_template(
'views/pricing/how-to-pay.html',
@@ -34,6 +37,7 @@ def how_to_pay():
@main.route('/pricing/billing-details')
@user_is_logged_in
def billing_details():
if current_user.is_authenticated:
return render_template(

View File

@@ -451,7 +451,6 @@ def add_service_template(service_id, template_type, template_folder_id=None):
form.template_content.data,
service_id,
form.subject.data if hasattr(form, 'subject') else None,
form.process_type.data,
template_folder_id
)
except HTTPError as e:
@@ -525,8 +524,7 @@ def edit_service_template(service_id, template_id):
template['template_type'],
form.template_content.data,
service_id,
subject,
form.process_type.data,
subject
)
except HTTPError as e:
if e.status_code == 400:

View File

@@ -163,7 +163,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
return self.delete(endpoint, data)
@cache.delete('service-{service_id}-templates')
def create_service_template(self, name, type_, content, service_id, subject=None, process_type='normal',
def create_service_template(self, name, type_, content, service_id, subject=None,
parent_folder_id=None):
"""
Create a service template.
@@ -173,7 +173,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
"template_type": type_,
"content": content,
"service": service_id,
"process_type": process_type,
"process_type": 'normal',
}
if subject:
data.update({
@@ -190,7 +190,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
@cache.delete('service-{service_id}-templates')
@cache.delete_by_pattern('service-{service_id}-template-*')
def update_service_template(
self, id_, name, type_, content, service_id, subject=None, process_type=None
self, id_, name, type_, content, service_id, subject=None
):
"""
Update a service template.
@@ -206,10 +206,9 @@ class ServiceAPIClient(NotifyAdminAPIClient):
data.update({
'subject': subject
})
if process_type:
data.update({
'process_type': process_type
})
data.update({
'process_type': 'normal'
})
data = _attach_current_user(data)
endpoint = "/service/{0}/template/{1}".format(service_id, id_)
return self.post(endpoint, data)

View File

@@ -31,7 +31,7 @@
{% endblock %}
{% block meta %}
{% endblock %}
<script type="text/javascript" src="{{ asset_url('js/gtm_head.js') }}"></script>
<!-- <script type="text/javascript" src="{{ asset_url('js/gtm_head.js') }}"></script> -->
{% endblock %}
{% block pageTitle %}
@@ -51,6 +51,16 @@
{% if current_user.is_authenticated %}
{% if current_user.platform_admin %}
{% set navigation = [
{
"href": url_for('main.get_started'),
"text": "Using notify",
"active": header_navigation.is_selected('using_notify')
},
{
"href": url_for('main.features'),
"text": "Features",
"active": header_navigation.is_selected('features')
},
{
"href": url_for('main.user_profile'),
"text": current_user.name,

View File

@@ -5,9 +5,12 @@
{% if notifications_deleted %}
<div class="govuk-grid-row bottom-gutter-1-2">
{% for label, query_param, url, count in counts %}
<div class="govuk-grid-column-one-quarter">
{{ big_number(count, label, smaller=True) }}
</div>
{% if query_param == 'pending' %}
<div class="govuk-grid-column-one-quarter">{{ big_number(count, query_param, smaller=True) }}</div>
{% else %}
<div class="govuk-grid-column-one-quarter">{{ big_number(count, label, smaller=True) }}</div>
{% endif %}
{% endfor %}
</div>
{% else %}

View File

@@ -1,3 +1,4 @@
<div class="ajax-block-container">
{% set field_status = notification.status|format_notification_status_as_field_status(notification.notification_type) %}
{% set status_url = notification.status|format_notification_status_as_url(notification.notification_type) %}
@@ -5,9 +6,18 @@
{% if status_url %}
<a class="govuk-link govuk-link--destructive" href="{{ status_url }}">
{% endif %}
{% if notification.status != 'sending' %}
{{ notification.status|format_notification_status(
notification.template.template_type
) }}
{% endif %}
{% if notification.status == 'sending' %}
<p class="notification-status {{ field_status }}">
Pending. Messages will remain in pending state until carrier status is received, typically 5 minutes.
</p>
{% endif %}
{% if status_url %}
</a>
{% endif %}
@@ -15,4 +25,5 @@
(test)
{% endif %}
</p>
</div>

View File

@@ -1,5 +1,4 @@
{% from "components/pill.html" import pill %}
<div class='bottom-gutter ajax-block-container'>
{{ pill(
status_filters,

View File

@@ -50,7 +50,7 @@
{{ big_number(
item.notifications_sending,
smallest=True,
label='sending',
label='pending',
) }}
</div>
<div class="govuk-grid-column-one-third">

View File

@@ -17,6 +17,6 @@
{{ ajax_block(partials, updates_url, 'counts', finished=job.processing_finished) }}
{{ ajax_block(partials, updates_url, 'notifications', finished=job.processing_finished) }}
<div>&nbsp;</div>
<div> </div>
{% endblock %}

View File

@@ -25,6 +25,11 @@
'counts'
) }}
<p class="notification-status {{ field_status }}">
Messages will remain in pending state until carrier status is received, typically 5 minutes.
</p>
{% call form_wrapper(
action=url_for('.view_notifications', service_id=current_service.id, message_type=message_type),
class="usa-search margin-bottom-2"
@@ -50,6 +55,10 @@
{% endcall %}
{% call form_wrapper(id="search-form") %}
<input type="hidden" name="to" {% if search_form.to.data %}value="{{ search_form.to.data }}{% endif %}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

View File

@@ -50,7 +50,7 @@
</div>
{% if current_user.has_permissions('manage_templates') and current_template_folder_id and user_has_template_folder_permission %}
<div class="govuk-grid-column-one-sixth">
<a href="{{ url_for('.manage_template_folder', service_id=current_service.id, template_folder_id=current_template_folder_id) }}" class="govuk-link govuk-link--no-visited-state folder-heading-manage-link">Manage<span class="usa-sr-only"> this folder</span></a>
<a href="{{ url_for('.manage_template_folder', service_id=current_service.id, template_folder_id=current_template_folder_id) }}" class="usa-link folder-heading-manage-link">Manage<span class="usa-sr-only"> this folder</span></a>
</div>
{% endif %}
</div>

View File

@@ -62,7 +62,7 @@ def generate_notifications_csv(**kwargs):
original_column_headers = original_upload.column_headers
fieldnames = ['Row number'] + original_column_headers + ['Template', 'Type', 'Job', 'Status', 'Time']
else:
fieldnames = ['Recipient', 'Reference', 'Template', 'Type', 'Sent by', 'Sent by email', 'Job', 'Status', 'Time']
fieldnames = ['Recipient', 'Template', 'Type', 'Sent by', 'Job', 'Status', 'Time']
yield ','.join(fieldnames) + '\n'
@@ -85,11 +85,9 @@ def generate_notifications_csv(**kwargs):
else:
values = [
notification['recipient'],
notification['client_reference'],
notification['template_name'],
notification['template_type'],
notification['created_by_name'] or '',
notification['created_by_email_address'] or '',
notification['job_name'] or '',
notification['status'],
notification['created_at']