mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
Added current_service to flask context and template context.
Fix all tests and conflicts. Removed comment line.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
<p>
|
||||
API usage is described in
|
||||
<a href="{{ url_for('.documentation', service_id=service_id) }}">the
|
||||
<a href="{{ url_for('.documentation', service_id=current_service.id) }}">the
|
||||
developer documentation</a>.
|
||||
</p>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
Service ID
|
||||
</h2>
|
||||
<p class="api-key-key">
|
||||
{{ service_id }}
|
||||
{{ current_service.id }}
|
||||
</p>
|
||||
|
||||
{% call(item) list_table(
|
||||
@@ -45,13 +45,13 @@
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
{% call field(align='right', status='error') %}
|
||||
<a href='{{ url_for('.revoke_api_key', service_id=service_id, key_id=item.id) }}'>Revoke</a>
|
||||
<a href='{{ url_for('.revoke_api_key', service_id=current_service.id, key_id=item.id) }}'>Revoke</a>
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
|
||||
<p class='table-show-more-link'>
|
||||
<a href="{{ url_for('.create_api_key', service_id=service_id) }}">Create a new API key</a>
|
||||
<a href="{{ url_for('.create_api_key', service_id=current_service.id) }}">Create a new API key</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
{{ email_message(
|
||||
template.subject,
|
||||
template.formatted_as_markup if errors else template.replaced,
|
||||
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
|
||||
from_name=service.name
|
||||
from_address='{}@notifications.service.gov.uk'.format(current_service.email_from),
|
||||
from_name=current_service.name
|
||||
)}}
|
||||
{% elif 'sms' == template.template_type %}
|
||||
<div class="grid-row">
|
||||
@@ -64,10 +64,10 @@
|
||||
{% if errors %}
|
||||
{{file_upload(form.file, button_text='Re-upload your file')}}
|
||||
{% else %}
|
||||
<form method="post" enctype="multipart/form-data" action="{{url_for('main.start_job', service_id=service_id, upload_id=upload_id)}}">
|
||||
<form method="post" enctype="multipart/form-data" action="{{url_for('main.start_job', service_id=current_service.id, upload_id=upload_id)}}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="button" value="{{ send_button_text }}" />
|
||||
<a href="{{url_for('.send_messages', service_id=service_id, template_id=template.id)}}" class="page-footer-back-link">Back</a>
|
||||
<a href="{{url_for('.send_messages', service_id=current_service.id, template_id=template.id)}}" class="page-footer-back-link">Back</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
You need a template before you can send
|
||||
{{ 'emails' if 'email' == template_type else 'text messages' }}
|
||||
</p>
|
||||
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type=template_type) }}" class="button">Add a new template</a>
|
||||
<a href="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}" class="button">Add a new template</a>
|
||||
{% else %}
|
||||
<p>You need to ask your service manager to add templates before you can send messages</p>
|
||||
{% endif %}
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
|
||||
<div class="column-one-third">
|
||||
<a href="{{ url_for('.add_service_template', service_id=service_id, template_type=template_type) }}" class="button align-with-heading">Add new template</a>
|
||||
<a href="{{ url_for('.add_service_template', service_id=current_service.id, template_type=template_type) }}" class="button align-with-heading">Add new template</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -46,7 +46,7 @@
|
||||
template.formatted_as_markup,
|
||||
name=template.name,
|
||||
edit_link=(
|
||||
url_for(".edit_service_template", service_id=service_id, template_id=template.id)
|
||||
url_for(".edit_service_template", service_id=current_service.id, template_id=template.id)
|
||||
if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) else
|
||||
None
|
||||
)
|
||||
@@ -56,7 +56,7 @@
|
||||
template.formatted_as_markup,
|
||||
name=template.name,
|
||||
edit_link=(
|
||||
url_for(".edit_service_template", service_id=service_id, template_id=template.id)
|
||||
url_for(".edit_service_template", service_id=current_service.id, template_id=template.id)
|
||||
if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) else
|
||||
None
|
||||
)
|
||||
@@ -66,11 +66,11 @@
|
||||
<div class="column-one-third">
|
||||
<div class="sms-message-use-links">
|
||||
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
|
||||
<a href="{{ url_for(".send_messages", service_id=service_id, template_id=template.id) }}">Send from a CSV file</a>
|
||||
<a href="{{ url_for(".send_message_to_self", service_id=service_id, template_id=template.id) }}">Send yourself a test</a>
|
||||
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}">Send from a CSV file</a>
|
||||
<a href="{{ url_for(".send_message_to_self", service_id=current_service.id, template_id=template.id) }}">Send yourself a test</a>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions(permissions=['manage_api_keys']) %}
|
||||
<a href="{{ url_for(".send_from_api", service_id=service_id, template_id=template.id) }}">API integration</a>
|
||||
<a href="{{ url_for(".send_from_api", service_id=current_service.id, template_id=template.id) }}">API integration</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ session.get('service_name', 'Dashboard') }} – GOV.UK Notify
|
||||
{{ current_service.name }} – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{% if not templates and current_user.has_permissions(['send_texts', 'send_emails', 'send_letters'], any_=True) %}
|
||||
{% include 'views/dashboard/get-started.html' %}
|
||||
{% elif service.restricted %}
|
||||
{% elif current_service.restricted %}
|
||||
<div class="dashboard">
|
||||
{% include 'views/dashboard/trial-mode-banner.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{url_for(".service_dashboard_updates", service_id=service_id)}}"
|
||||
data-resource="{{url_for(".service_dashboard_updates", service_id=current_service.id)}}"
|
||||
data-key="today"
|
||||
data-interval-seconds="10"
|
||||
>
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
{% call banner_wrapper(type='tour') %}
|
||||
<h2 class="heading-large">You’re ready to get started</h2>
|
||||
<p>
|
||||
<a href='{{ url_for(".add_service_template", service_id=service_id, template_type="sms") }}'>
|
||||
<a href='{{ url_for(".add_service_template", service_id=current_service.id, template_type="sms") }}'>
|
||||
Set up a text message template
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href='{{ url_for(".add_service_template", service_id=service_id, template_type="email") }}'>
|
||||
<a href='{{ url_for(".add_service_template", service_id=current_service.id, template_type="email") }}'>
|
||||
Set up an email template
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
field_headings=['File', 'Started', right_aligned_field_heading('Rows')]
|
||||
) %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
<a href="{{ url_for('.view_job', service_id=current_service.id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{{ item.created_at|format_datetime }}
|
||||
@@ -19,7 +19,7 @@
|
||||
{% if more_jobs_to_show %}
|
||||
{% if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters']) %}
|
||||
<p class="table-show-more-link">
|
||||
<a href="{{ url_for('.view_jobs', service_id=service_id) }}">See all sent batch messages</a>
|
||||
<a href="{{ url_for('.view_jobs', service_id=current_service.id) }}">See all sent batch messages</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -36,5 +36,4 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -23,7 +23,7 @@ Manage users – GOV.UK Notify
|
||||
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
delete_link=url_for('.remove_user_from_service', service_id=service_id, user_id=user.id) if user or None,
|
||||
delete_link=url_for('.remove_user_from_service', service_id=current_service.id, user_id=user.id) if user or None,
|
||||
delete_link_text='Remove user from service'
|
||||
) }}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
{% if not finished_at %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{url_for(".view_job_updates", service_id=service_id, job_id=job_id)}}"
|
||||
data-resource="{{url_for(".view_job_updates", service_id=current_service.id, job_id=job_id)}}"
|
||||
data-key="status"
|
||||
>
|
||||
{% endif %}
|
||||
@@ -45,7 +45,7 @@
|
||||
{% if not finished_at %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{url_for(".view_job_updates", service_id=service_id, job_id=job_id)}}"
|
||||
data-resource="{{url_for(".view_job_updates", service_id=current_service.id, job_id=job_id)}}"
|
||||
data-key="counts"
|
||||
>
|
||||
{% endif %}
|
||||
@@ -57,7 +57,7 @@
|
||||
{% if not finished_at %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{url_for(".view_job_updates", service_id=service_id, job_id=job_id)}}"
|
||||
data-resource="{{url_for(".view_job_updates", service_id=current_service.id, job_id=job_id)}}"
|
||||
data-key="notifications"
|
||||
>
|
||||
{% endif %}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
field_headings=['Job', 'Time', right_aligned_field_heading('Status')]
|
||||
) %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
<a href="{{ url_for('.view_job', service_id=current_service.id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{{ item.created_at | format_datetime}}
|
||||
|
||||
@@ -24,7 +24,7 @@ Manage users – GOV.UK Notify
|
||||
</div>
|
||||
{% if current_user.has_permissions(['manage_users']) %}
|
||||
<div class="column-one-third">
|
||||
<a href="{{ url_for('.invite_user', service_id=service_id) }}" class="button align-with-heading">Invite team member</a>
|
||||
<a href="{{ url_for('.invite_user', service_id=current_service.id) }}" class="button align-with-heading">Invite team member</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -41,7 +41,7 @@ Manage users – GOV.UK Notify
|
||||
{% call field(align='right') %}
|
||||
{% if current_user.has_permissions(['manage_users']) %}
|
||||
{% if current_user.id != item.id %}
|
||||
<a href="{{ url_for('.edit_user_permissions', service_id=service_id, user_id=item.id)}}">Edit</a>
|
||||
<a href="{{ url_for('.edit_user_permissions', service_id=current_service.id, user_id=item.id)}}">Edit</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
@@ -60,7 +60,7 @@ Manage users – GOV.UK Notify
|
||||
{% if item.status == 'pending' %}
|
||||
{% call field(align='right') %}
|
||||
{% if current_user.has_permissions(['manage_users']) %}
|
||||
<a href="{{ url_for('.cancel_invited_user', service_id=service_id, invited_user_id=item.id)}}">Cancel invitation</a>
|
||||
<a href="{{ url_for('.cancel_invited_user', service_id=current_service.id, invited_user_id=item.id)}}">Cancel invitation</a>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
|
||||
{{ page_footer(
|
||||
secondary_link = url_for('.view_job', service_id=service_id, job_id=job_id),
|
||||
secondary_link = url_for('.view_job', service_id=current_service.id, job_id=job_id),
|
||||
secondary_link_text = 'View other messages in this job'
|
||||
) }}
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@
|
||||
{{ item.to }}
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for(".choose_template", service_id=service_id, template_type=item.template.template_type, _anchor=item.template.name|linkable_name) }}">{{ item.template.name }}</a>
|
||||
<a href="{{ url_for(".choose_template", service_id=current_service.id, template_type=item.template.template_type, _anchor=item.template.name|linkable_name) }}">{{ item.template.name }}</a>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{{ item.template.template_type }}
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{% if item.job %}
|
||||
<a href="{{ url_for(".view_job", service_id=service_id, job_id=item.job.id) }}">{{ item.job.original_file_name }}</a>
|
||||
<a href="{{ url_for(".view_job", service_id=current_service.id, job_id=item.job.id) }}">{{ item.job.original_file_name }}</a>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
{{ email_message(
|
||||
template.subject,
|
||||
template.formatted_as_markup,
|
||||
from_address='{}@notifications.service.gov.uk'.format(service.email_from),
|
||||
from_name=service.name
|
||||
from_address='{}@notifications.service.gov.uk'.format(current_service.email_from),
|
||||
from_name=current_service.name
|
||||
) }}
|
||||
{% endif %}
|
||||
|
||||
@@ -51,10 +51,9 @@
|
||||
{% endcall %}
|
||||
|
||||
<p class="bottom-gutter">
|
||||
<a href="{{ url_for('.get_example_csv', service_id=service_id, template_id=template.id) }}">Download this example</a>
|
||||
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}">Download this example</a>
|
||||
</p>
|
||||
|
||||
|
||||
{{file_upload(form.file, button_text='Upload your CSV file')}}
|
||||
|
||||
{% endblock %}
|
||||
@@ -12,21 +12,21 @@
|
||||
{{ browse_list([
|
||||
{
|
||||
'title': 'Change your service name',
|
||||
'link': url_for('.service_name_change', service_id=service_id)
|
||||
'link': url_for('.service_name_change', service_id=current_service.id)
|
||||
},
|
||||
{
|
||||
'title': 'Request to go live and turn off sending restrictions',
|
||||
'link': url_for('.service_request_to_go_live', service_id=service_id),
|
||||
'link': url_for('.service_request_to_go_live', service_id=current_service.id),
|
||||
'hint': 'A live service can send notifications to any phone number or email address',
|
||||
} if not service.live else {
|
||||
} if not current_service.live else {
|
||||
},
|
||||
{
|
||||
'title': 'Temporarily suspend API keys',
|
||||
'link': url_for('.service_status_change', service_id=service_id),
|
||||
'link': url_for('.service_status_change', service_id=current_service.id),
|
||||
'destructive': True
|
||||
} if not service.active else {
|
||||
} if not current_service.active else {
|
||||
'title': 'Reactivate API keys',
|
||||
'link': url_for('.service_status_change', service_id=service_id)
|
||||
'link': url_for('.service_status_change', service_id=current_service.id)
|
||||
}
|
||||
]) }}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
{{ page_footer(
|
||||
'Confirm',
|
||||
destructive=destructive,
|
||||
back_link=url_for('.service_settings', service_id=service_id)
|
||||
back_link=url_for('.service_settings', service_id=current_service.id)
|
||||
) }}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
<form method="post">
|
||||
{{ page_footer(
|
||||
'Yes, delete ‘{}’'.format(service.name),
|
||||
'Yes, delete ‘{}’'.format(current_service.name),
|
||||
destructive=True,
|
||||
back_link=url_for('.service_settings', service_id=service_id)
|
||||
back_link=url_for('.service_settings', service_id=current_service.id)
|
||||
) }}
|
||||
</form>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{{ textbox(form.name) }}
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
back_link=url_for('.service_settings', service_id=service_id),
|
||||
back_link=url_for('.service_settings', service_id=current_service.id),
|
||||
back_link_text='Back to settings'
|
||||
) }}
|
||||
</form>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{{ page_footer(
|
||||
'Suspend API keys',
|
||||
destructive=True,
|
||||
back_link=url_for('.service_settings', service_id=service_id),
|
||||
back_link=url_for('.service_settings', service_id=current_service.id),
|
||||
back_link_text='Back to settings'
|
||||
) }}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user