mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
change letter previews to be in the no_cookies blueprint
this blueprint should be applied to every endpoint that is loaded async (as in via a src tag on an img, iframe, etc)
This commit is contained in:
@@ -200,7 +200,7 @@ def letter_template():
|
|||||||
filename = 'no-branding'
|
filename = 'no-branding'
|
||||||
|
|
||||||
template = {'subject': '', 'content': ''}
|
template = {'subject': '', 'content': ''}
|
||||||
image_url = url_for('main.letter_branding_preview_image', filename=filename)
|
image_url = url_for('no_cookie.letter_branding_preview_image', filename=filename)
|
||||||
|
|
||||||
template_image = str(LetterImageTemplate(
|
template_image = str(LetterImageTemplate(
|
||||||
template,
|
template,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ from app import (
|
|||||||
notification_api_client,
|
notification_api_client,
|
||||||
service_api_client,
|
service_api_client,
|
||||||
)
|
)
|
||||||
from app.main import main
|
from app.main import main, no_cookie
|
||||||
from app.main.forms import (
|
from app.main.forms import (
|
||||||
ChooseTimeForm,
|
ChooseTimeForm,
|
||||||
CsvUploadForm,
|
CsvUploadForm,
|
||||||
@@ -135,7 +135,7 @@ def send_messages(service_id, template_id):
|
|||||||
current_service,
|
current_service,
|
||||||
show_recipient=True,
|
show_recipient=True,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype='png',
|
filetype='png',
|
||||||
@@ -364,7 +364,7 @@ def send_test_step(service_id, template_id, step_index):
|
|||||||
current_service,
|
current_service,
|
||||||
show_recipient=True,
|
show_recipient=True,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype='png',
|
filetype='png',
|
||||||
@@ -465,7 +465,7 @@ def send_test_step(service_id, template_id, step_index):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<uuid:service_id>/send/<uuid:template_id>/test.<filetype>", methods=['GET'])
|
@no_cookie.route("/services/<uuid:service_id>/send/<uuid:template_id>/test.<filetype>", methods=['GET'])
|
||||||
@user_has_permissions('send_messages')
|
@user_has_permissions('send_messages')
|
||||||
def send_test_preview(service_id, template_id, filetype):
|
def send_test_preview(service_id, template_id, filetype):
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ def send_test_preview(service_id, template_id, filetype):
|
|||||||
db_template,
|
db_template,
|
||||||
current_service,
|
current_service,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype='png',
|
filetype='png',
|
||||||
@@ -502,7 +502,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
|
|||||||
# errors when we try and unpack in the check_messages route.
|
# errors when we try and unpack in the check_messages route.
|
||||||
# Rasing a werkzeug.routing redirect means that doesn't happen.
|
# Rasing a werkzeug.routing redirect means that doesn't happen.
|
||||||
raise PermanentRedirect(url_for(
|
raise PermanentRedirect(url_for(
|
||||||
'.send_messages',
|
'main.send_messages',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id
|
template_id=template_id
|
||||||
))
|
))
|
||||||
@@ -529,7 +529,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
|
|||||||
current_service,
|
current_service,
|
||||||
show_recipient=True,
|
show_recipient=True,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
upload_id=upload_id,
|
upload_id=upload_id,
|
||||||
@@ -556,10 +556,10 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
|
|||||||
|
|
||||||
if request.args.get('from_test'):
|
if request.args.get('from_test'):
|
||||||
# only happens if generating a letter preview test
|
# only happens if generating a letter preview test
|
||||||
back_link = url_for('.send_test', service_id=service_id, template_id=template.id)
|
back_link = url_for('main.send_test', service_id=service_id, template_id=template.id)
|
||||||
choose_time_form = None
|
choose_time_form = None
|
||||||
else:
|
else:
|
||||||
back_link = url_for('.send_messages', service_id=service_id, template_id=template.id)
|
back_link = url_for('main.send_messages', service_id=service_id, template_id=template.id)
|
||||||
choose_time_form = ChooseTimeForm()
|
choose_time_form = ChooseTimeForm()
|
||||||
|
|
||||||
if preview_row < 2:
|
if preview_row < 2:
|
||||||
@@ -650,11 +650,11 @@ def check_messages(service_id, template_id, upload_id, row_index=2):
|
|||||||
return render_template('views/check/ok.html', **data)
|
return render_template('views/check/ok.html', **data)
|
||||||
|
|
||||||
|
|
||||||
@main.route(
|
@no_cookie.route(
|
||||||
"/services/<uuid:service_id>/<uuid:template_id>/check/<uuid:upload_id>.<filetype>",
|
"/services/<uuid:service_id>/<uuid:template_id>/check/<uuid:upload_id>.<filetype>",
|
||||||
methods=['GET'],
|
methods=['GET'],
|
||||||
)
|
)
|
||||||
@main.route(
|
@no_cookie.route(
|
||||||
"/services/<uuid:service_id>/<uuid:template_id>/check/<uuid:upload_id>/row-<int:row_index>.<filetype>",
|
"/services/<uuid:service_id>/<uuid:template_id>/check/<uuid:upload_id>/row-<int:row_index>.<filetype>",
|
||||||
methods=['GET'],
|
methods=['GET'],
|
||||||
)
|
)
|
||||||
@@ -673,7 +673,7 @@ def check_messages_preview(service_id, template_id, upload_id, filetype, row_ind
|
|||||||
return TemplatePreview.from_utils_template(template, filetype, page=page)
|
return TemplatePreview.from_utils_template(template, filetype, page=page)
|
||||||
|
|
||||||
|
|
||||||
@main.route(
|
@no_cookie.route(
|
||||||
"/services/<uuid:service_id>/<uuid:template_id>/check.<filetype>",
|
"/services/<uuid:service_id>/<uuid:template_id>/check.<filetype>",
|
||||||
methods=['GET'],
|
methods=['GET'],
|
||||||
)
|
)
|
||||||
@@ -868,7 +868,7 @@ def _check_notification(service_id, template_id, exception=None):
|
|||||||
email_reply_to=email_reply_to,
|
email_reply_to=email_reply_to,
|
||||||
sms_sender=sms_sender,
|
sms_sender=sms_sender,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.check_notification_preview',
|
'no_cookie.check_notification_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype='png',
|
filetype='png',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from app import (
|
|||||||
template_folder_api_client,
|
template_folder_api_client,
|
||||||
template_statistics_client,
|
template_statistics_client,
|
||||||
)
|
)
|
||||||
from app.main import main
|
from app.main import main, no_cookie
|
||||||
from app.main.forms import (
|
from app.main.forms import (
|
||||||
EmailTemplateForm,
|
EmailTemplateForm,
|
||||||
LetterTemplateForm,
|
LetterTemplateForm,
|
||||||
@@ -67,7 +67,7 @@ def view_template(service_id, template_id):
|
|||||||
template,
|
template,
|
||||||
current_service,
|
current_service,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype='png',
|
filetype='png',
|
||||||
@@ -219,7 +219,7 @@ def get_template_nav_items(template_folder_id):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<uuid:service_id>/templates/<uuid:template_id>.<filetype>")
|
@no_cookie.route("/services/<uuid:service_id>/templates/<uuid:template_id>.<filetype>")
|
||||||
@user_has_permissions()
|
@user_has_permissions()
|
||||||
def view_letter_template_preview(service_id, template_id, filetype):
|
def view_letter_template_preview(service_id, template_id, filetype):
|
||||||
if filetype not in ('pdf', 'png'):
|
if filetype not in ('pdf', 'png'):
|
||||||
@@ -230,7 +230,7 @@ def view_letter_template_preview(service_id, template_id, filetype):
|
|||||||
return TemplatePreview.from_database_object(db_template, filetype, page=request.args.get('page'))
|
return TemplatePreview.from_database_object(db_template, filetype, page=request.args.get('page'))
|
||||||
|
|
||||||
|
|
||||||
@main.route("/templates/letter-preview-image/<filename>")
|
@no_cookie.route("/templates/letter-preview-image/<filename>")
|
||||||
@user_is_platform_admin
|
@user_is_platform_admin
|
||||||
def letter_branding_preview_image(filename):
|
def letter_branding_preview_image(filename):
|
||||||
template = {
|
template = {
|
||||||
@@ -262,7 +262,7 @@ def _view_template_version(service_id, template_id, version, letters_as_pdf=Fals
|
|||||||
current_service.get_template(template_id, version=version),
|
current_service.get_template(template_id, version=version),
|
||||||
current_service,
|
current_service,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.view_template_version_preview',
|
'no_cookie.view_template_version_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
version=version,
|
version=version,
|
||||||
@@ -280,7 +280,7 @@ def view_template_version(service_id, template_id, version):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<uuid:service_id>/templates/<uuid:template_id>/version/<int:version>.<filetype>")
|
@no_cookie.route("/services/<uuid:service_id>/templates/<uuid:template_id>/version/<int:version>.<filetype>")
|
||||||
@user_has_permissions()
|
@user_has_permissions()
|
||||||
def view_template_version_preview(service_id, template_id, version, filetype):
|
def view_template_version_preview(service_id, template_id, version, filetype):
|
||||||
db_template = current_service.get_template(template_id, version=version)
|
db_template = current_service.get_template(template_id, version=version)
|
||||||
@@ -697,7 +697,7 @@ def delete_service_template(service_id, template_id):
|
|||||||
template,
|
template,
|
||||||
current_service,
|
current_service,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template['id'],
|
template_id=template['id'],
|
||||||
filetype='png',
|
filetype='png',
|
||||||
@@ -719,7 +719,7 @@ def confirm_redact_template(service_id, template_id):
|
|||||||
template,
|
template,
|
||||||
current_service,
|
current_service,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype='png',
|
filetype='png',
|
||||||
@@ -759,7 +759,7 @@ def view_template_versions(service_id, template_id):
|
|||||||
template,
|
template,
|
||||||
current_service,
|
current_service,
|
||||||
letter_preview_url=url_for(
|
letter_preview_url=url_for(
|
||||||
'.view_template_version_preview',
|
'no_cookie.view_template_version_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
version=template['version'],
|
version=template['version'],
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class Navigation:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.mapping = {
|
self.mapping = {
|
||||||
navigation: {
|
navigation: {
|
||||||
'main.{}'.format(endpoint) for endpoint in endpoints
|
# if not specified, assume endpoints are all in the `main` blueprint.
|
||||||
|
self._get_endpoint_with_blueprint(endpoint) for endpoint in endpoints
|
||||||
} for navigation, endpoints in self.mapping.items()
|
} for navigation, endpoints in self.mapping.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ class Navigation:
|
|||||||
@property
|
@property
|
||||||
def endpoints_without_navigation(self):
|
def endpoints_without_navigation(self):
|
||||||
return tuple(
|
return tuple(
|
||||||
'main.{}'.format(endpoint) for endpoint in self.exclude
|
self._get_endpoint_with_blueprint(endpoint) for endpoint in self.exclude
|
||||||
) + ('static', 'status.show_status')
|
) + ('static', 'status.show_status')
|
||||||
|
|
||||||
def is_selected(self, navigation_item):
|
def is_selected(self, navigation_item):
|
||||||
@@ -34,6 +35,10 @@ class Navigation:
|
|||||||
return self.selected_attribute
|
return self.selected_attribute
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _get_endpoint_with_blueprint(endpoint):
|
||||||
|
return endpoint if '.' in endpoint else 'main.{}'.format(endpoint)
|
||||||
|
|
||||||
|
|
||||||
class HeaderNavigation(Navigation):
|
class HeaderNavigation(Navigation):
|
||||||
|
|
||||||
@@ -141,9 +146,9 @@ class HeaderNavigation(Navigation):
|
|||||||
'check_and_resend_text_code',
|
'check_and_resend_text_code',
|
||||||
'check_and_resend_verification_code',
|
'check_and_resend_verification_code',
|
||||||
'check_messages',
|
'check_messages',
|
||||||
'check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
'check_notification',
|
'check_notification',
|
||||||
'check_notification_preview',
|
'no_cookie.check_notification_preview',
|
||||||
'choose_account',
|
'choose_account',
|
||||||
'choose_service',
|
'choose_service',
|
||||||
'choose_template',
|
'choose_template',
|
||||||
@@ -201,7 +206,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'information_security',
|
'information_security',
|
||||||
'invite_org_user',
|
'invite_org_user',
|
||||||
'invite_user',
|
'invite_user',
|
||||||
'letter_branding_preview_image',
|
'no_cookie.letter_branding_preview_image',
|
||||||
'letter_template',
|
'letter_template',
|
||||||
'link_service_to_organisation',
|
'link_service_to_organisation',
|
||||||
'manage_org_users',
|
'manage_org_users',
|
||||||
@@ -243,7 +248,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'send_one_off',
|
'send_one_off',
|
||||||
'send_one_off_step',
|
'send_one_off_step',
|
||||||
'send_test',
|
'send_test',
|
||||||
'send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
'send_test_step',
|
'send_test_step',
|
||||||
'send_uploaded_letter',
|
'send_uploaded_letter',
|
||||||
'service_add_email_reply_to',
|
'service_add_email_reply_to',
|
||||||
@@ -313,7 +318,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'view_job_updates',
|
'view_job_updates',
|
||||||
'view_jobs',
|
'view_jobs',
|
||||||
'view_letter_notification_as_preview',
|
'view_letter_notification_as_preview',
|
||||||
'view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
'view_letter_upload_as_preview',
|
'view_letter_upload_as_preview',
|
||||||
'view_notification',
|
'view_notification',
|
||||||
'view_notification_updates',
|
'view_notification_updates',
|
||||||
@@ -321,7 +326,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'view_notifications_csv',
|
'view_notifications_csv',
|
||||||
'view_template',
|
'view_template',
|
||||||
'view_template_version',
|
'view_template_version',
|
||||||
'view_template_version_preview',
|
'no_cookie.view_template_version_preview',
|
||||||
'view_template_versions',
|
'view_template_versions',
|
||||||
'whitelist',
|
'whitelist',
|
||||||
}
|
}
|
||||||
@@ -363,7 +368,7 @@ class MainNavigation(Navigation):
|
|||||||
'send_one_off',
|
'send_one_off',
|
||||||
'send_one_off_step',
|
'send_one_off_step',
|
||||||
'send_test',
|
'send_test',
|
||||||
'send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
'send_test_step',
|
'send_test_step',
|
||||||
'set_sender',
|
'set_sender',
|
||||||
'set_template_sender',
|
'set_template_sender',
|
||||||
@@ -465,8 +470,8 @@ class MainNavigation(Navigation):
|
|||||||
'cancel_letter_job',
|
'cancel_letter_job',
|
||||||
'check_and_resend_text_code',
|
'check_and_resend_text_code',
|
||||||
'check_and_resend_verification_code',
|
'check_and_resend_verification_code',
|
||||||
'check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
'check_notification_preview',
|
'no_cookie.check_notification_preview',
|
||||||
'choose_account',
|
'choose_account',
|
||||||
'choose_service',
|
'choose_service',
|
||||||
'clear_cache',
|
'clear_cache',
|
||||||
@@ -520,7 +525,7 @@ class MainNavigation(Navigation):
|
|||||||
'integration_testing',
|
'integration_testing',
|
||||||
'invite_org_user',
|
'invite_org_user',
|
||||||
'letter_branding',
|
'letter_branding',
|
||||||
'letter_branding_preview_image',
|
'no_cookie.letter_branding_preview_image',
|
||||||
'live_services',
|
'live_services',
|
||||||
'live_services_csv',
|
'live_services_csv',
|
||||||
'letter_template',
|
'letter_template',
|
||||||
@@ -611,13 +616,13 @@ class MainNavigation(Navigation):
|
|||||||
'view_job_csv',
|
'view_job_csv',
|
||||||
'view_job_updates',
|
'view_job_updates',
|
||||||
'view_letter_notification_as_preview',
|
'view_letter_notification_as_preview',
|
||||||
'view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
'view_letter_upload_as_preview',
|
'view_letter_upload_as_preview',
|
||||||
'view_notification_updates',
|
'view_notification_updates',
|
||||||
'view_notifications_csv',
|
'view_notifications_csv',
|
||||||
'view_provider',
|
'view_provider',
|
||||||
'view_providers',
|
'view_providers',
|
||||||
'view_template_version_preview',
|
'no_cookie.view_template_version_preview',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -671,9 +676,9 @@ class CaseworkNavigation(Navigation):
|
|||||||
'check_and_resend_text_code',
|
'check_and_resend_text_code',
|
||||||
'check_and_resend_verification_code',
|
'check_and_resend_verification_code',
|
||||||
'check_messages',
|
'check_messages',
|
||||||
'check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
'check_notification',
|
'check_notification',
|
||||||
'check_notification_preview',
|
'no_cookie.check_notification_preview',
|
||||||
'choose_account',
|
'choose_account',
|
||||||
'choose_service',
|
'choose_service',
|
||||||
'choose_template_to_copy',
|
'choose_template_to_copy',
|
||||||
@@ -747,7 +752,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'integration_testing',
|
'integration_testing',
|
||||||
'invite_org_user',
|
'invite_org_user',
|
||||||
'invite_user',
|
'invite_user',
|
||||||
'letter_branding_preview_image',
|
'no_cookie.letter_branding_preview_image',
|
||||||
'letter_branding',
|
'letter_branding',
|
||||||
'letter_template',
|
'letter_template',
|
||||||
'link_service_to_organisation',
|
'link_service_to_organisation',
|
||||||
@@ -799,7 +804,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'security',
|
'security',
|
||||||
'send_messages',
|
'send_messages',
|
||||||
'send_notification',
|
'send_notification',
|
||||||
'send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
'send_uploaded_letter',
|
'send_uploaded_letter',
|
||||||
'service_add_email_reply_to',
|
'service_add_email_reply_to',
|
||||||
'service_add_letter_contact',
|
'service_add_letter_contact',
|
||||||
@@ -892,7 +897,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'view_job_csv',
|
'view_job_csv',
|
||||||
'view_job_updates',
|
'view_job_updates',
|
||||||
'view_letter_notification_as_preview',
|
'view_letter_notification_as_preview',
|
||||||
'view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
'view_letter_upload_as_preview',
|
'view_letter_upload_as_preview',
|
||||||
'view_notification_updates',
|
'view_notification_updates',
|
||||||
'view_notifications_csv',
|
'view_notifications_csv',
|
||||||
@@ -900,7 +905,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'view_providers',
|
'view_providers',
|
||||||
'view_template',
|
'view_template',
|
||||||
'view_template_version',
|
'view_template_version',
|
||||||
'view_template_version_preview',
|
'no_cookie.view_template_version_preview',
|
||||||
'view_template_versions',
|
'view_template_versions',
|
||||||
'whitelist',
|
'whitelist',
|
||||||
}
|
}
|
||||||
@@ -966,9 +971,9 @@ class OrgNavigation(Navigation):
|
|||||||
'check_and_resend_text_code',
|
'check_and_resend_text_code',
|
||||||
'check_and_resend_verification_code',
|
'check_and_resend_verification_code',
|
||||||
'check_messages',
|
'check_messages',
|
||||||
'check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
'check_notification',
|
'check_notification',
|
||||||
'check_notification_preview',
|
'no_cookie.check_notification_preview',
|
||||||
'choose_account',
|
'choose_account',
|
||||||
'choose_service',
|
'choose_service',
|
||||||
'choose_template',
|
'choose_template',
|
||||||
@@ -1030,7 +1035,7 @@ class OrgNavigation(Navigation):
|
|||||||
'integration_testing',
|
'integration_testing',
|
||||||
'invite_user',
|
'invite_user',
|
||||||
'letter_branding',
|
'letter_branding',
|
||||||
'letter_branding_preview_image',
|
'no_cookie.letter_branding_preview_image',
|
||||||
'letter_template',
|
'letter_template',
|
||||||
'link_service_to_organisation',
|
'link_service_to_organisation',
|
||||||
'live_services',
|
'live_services',
|
||||||
@@ -1077,7 +1082,7 @@ class OrgNavigation(Navigation):
|
|||||||
'send_one_off',
|
'send_one_off',
|
||||||
'send_one_off_step',
|
'send_one_off_step',
|
||||||
'send_test',
|
'send_test',
|
||||||
'send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
'send_test_step',
|
'send_test_step',
|
||||||
'send_uploaded_letter',
|
'send_uploaded_letter',
|
||||||
'service_add_email_reply_to',
|
'service_add_email_reply_to',
|
||||||
@@ -1176,7 +1181,7 @@ class OrgNavigation(Navigation):
|
|||||||
'view_job_updates',
|
'view_job_updates',
|
||||||
'view_jobs',
|
'view_jobs',
|
||||||
'view_letter_notification_as_preview',
|
'view_letter_notification_as_preview',
|
||||||
'view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
'view_letter_upload_as_preview',
|
'view_letter_upload_as_preview',
|
||||||
'view_notification',
|
'view_notification',
|
||||||
'view_notification_updates',
|
'view_notification_updates',
|
||||||
@@ -1186,7 +1191,7 @@ class OrgNavigation(Navigation):
|
|||||||
'view_providers',
|
'view_providers',
|
||||||
'view_template',
|
'view_template',
|
||||||
'view_template_version',
|
'view_template_version',
|
||||||
'view_template_version_preview',
|
'no_cookie.view_template_version_preview',
|
||||||
'view_template_versions',
|
'view_template_versions',
|
||||||
'whitelist',
|
'whitelist',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
{% if (template.template_type != 'letter' or not request.args.from_test) and not letter_too_long %}
|
{% if (template.template_type != 'letter' or not request.args.from_test) and not letter_too_long %}
|
||||||
<button type="submit" class="button">Send {{ count_of_recipients|format_thousands }} {{ message_count_label(count_of_recipients, template.template_type, suffix='') }}</button>
|
<button type="submit" class="button">Send {{ count_of_recipients|format_thousands }} {{ message_count_label(count_of_recipients, template.template_type, suffix='') }}</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_id=template.id, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a PDF</a>
|
<a href="{{ url_for('no_cookie.check_messages_preview', service_id=current_service.id, template_id=template.id, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a PDF</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
<button type="submit" class="button">Send 1 {{ message_count_label(1, template.template_type, suffix='') }}</button>
|
<button type="submit" class="button">Send 1 {{ message_count_label(1, template.template_type, suffix='') }}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if template.template_type == 'letter' %}
|
{% if template.template_type == 'letter' %}
|
||||||
<a href="{{ url_for('main.check_notification_preview', service_id=current_service.id, template_id=template.id, filetype='pdf') }}" download class="page-footer-right-aligned-link{% if error %}-without-button{% endif %}">Download as a PDF</a>
|
<a href="{{ url_for('no_cookie.check_notification_preview', service_id=current_service.id, template_id=template.id, filetype='pdf') }}" download class="page-footer-right-aligned-link{% if error %}-without-button{% endif %}">Download as a PDF</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ def test_letter_template_preview_links_to_the_correct_image(
|
|||||||
image_link = page.find('img')['src']
|
image_link = page.find('img')['src']
|
||||||
|
|
||||||
assert image_link == url_for(
|
assert image_link == url_for(
|
||||||
'main.letter_branding_preview_image',
|
'no_cookie.letter_branding_preview_image',
|
||||||
filename=filename,
|
filename=filename,
|
||||||
page=1
|
page=1
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ def test_upload_valid_csv_only_sets_meta_if_filename_known(
|
|||||||
)
|
)
|
||||||
|
|
||||||
client_request.get(
|
client_request.get(
|
||||||
'main.check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
template_id=fake_uuid,
|
template_id=fake_uuid,
|
||||||
upload_id=fake_uuid,
|
upload_id=fake_uuid,
|
||||||
@@ -1992,7 +1992,7 @@ def test_send_test_works_as_letter_preview(
|
|||||||
session['placeholders'] = {'address_line_1': 'Jo Lastname'}
|
session['placeholders'] = {'address_line_1': 'Jo Lastname'}
|
||||||
response = platform_admin_client.get(
|
response = platform_admin_client.get(
|
||||||
url_for(
|
url_for(
|
||||||
'main.send_test_preview',
|
'no_cookie.send_test_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
filetype=filetype
|
filetype=filetype
|
||||||
@@ -2384,7 +2384,7 @@ def test_should_show_preview_letter_message(
|
|||||||
|
|
||||||
response = platform_admin_client.get(
|
response = platform_admin_client.get(
|
||||||
url_for(
|
url_for(
|
||||||
'main.check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
service_id=service_id,
|
service_id=service_id,
|
||||||
template_id=fake_uuid,
|
template_id=fake_uuid,
|
||||||
upload_id=fake_uuid,
|
upload_id=fake_uuid,
|
||||||
@@ -2412,7 +2412,7 @@ def test_dont_show_preview_letter_templates_for_bad_filetype(
|
|||||||
):
|
):
|
||||||
resp = logged_in_client.get(
|
resp = logged_in_client.get(
|
||||||
url_for(
|
url_for(
|
||||||
'main.check_messages_preview',
|
'no_cookie.check_messages_preview',
|
||||||
service_id=service_one['id'],
|
service_id=service_one['id'],
|
||||||
template_id=fake_uuid,
|
template_id=fake_uuid,
|
||||||
upload_id=fake_uuid,
|
upload_id=fake_uuid,
|
||||||
@@ -3130,7 +3130,7 @@ def test_one_off_letters_have_download_link(
|
|||||||
assert len(page.select('.letter img')) == 5
|
assert len(page.select('.letter img')) == 5
|
||||||
|
|
||||||
assert page.select_one('a[download]')['href'] == url_for(
|
assert page.select_one('a[download]')['href'] == url_for(
|
||||||
'main.check_notification_preview',
|
'no_cookie.check_notification_preview',
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
template_id=fake_uuid,
|
template_id=fake_uuid,
|
||||||
filetype='pdf',
|
filetype='pdf',
|
||||||
|
|||||||
@@ -773,8 +773,8 @@ def test_should_show_page_template_with_priority_select_if_platform_admin(
|
|||||||
|
|
||||||
@pytest.mark.parametrize('filetype', ['pdf', 'png'])
|
@pytest.mark.parametrize('filetype', ['pdf', 'png'])
|
||||||
@pytest.mark.parametrize('view, extra_view_args', [
|
@pytest.mark.parametrize('view, extra_view_args', [
|
||||||
('.view_letter_template_preview', {}),
|
('no_cookie.view_letter_template_preview', {}),
|
||||||
('.view_template_version_preview', {'version': 1}),
|
('no_cookie.view_template_version_preview', {'version': 1}),
|
||||||
])
|
])
|
||||||
def test_should_show_preview_letter_templates(
|
def test_should_show_preview_letter_templates(
|
||||||
view,
|
view,
|
||||||
@@ -817,7 +817,7 @@ def test_dont_show_preview_letter_templates_for_bad_filetype(
|
|||||||
):
|
):
|
||||||
resp = logged_in_client.get(
|
resp = logged_in_client.get(
|
||||||
url_for(
|
url_for(
|
||||||
'.view_letter_template_preview',
|
'no_cookie.view_letter_template_preview',
|
||||||
service_id=service_one['id'],
|
service_id=service_one['id'],
|
||||||
template_id=fake_uuid,
|
template_id=fake_uuid,
|
||||||
filetype='blah'
|
filetype='blah'
|
||||||
@@ -842,7 +842,7 @@ def test_letter_branding_preview_image(
|
|||||||
return_value='foo'
|
return_value='foo'
|
||||||
)
|
)
|
||||||
resp = platform_admin_client.get(
|
resp = platform_admin_client.get(
|
||||||
url_for('.letter_branding_preview_image', filename=original_filename)
|
url_for('no_cookie.letter_branding_preview_image', filename=original_filename)
|
||||||
)
|
)
|
||||||
|
|
||||||
mocked_preview.assert_called_with(ANY, new_filename)
|
mocked_preview.assert_called_with(ANY, new_filename)
|
||||||
|
|||||||
Reference in New Issue
Block a user