mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-22 02:00:57 -04:00
Don’t repeat the letter spec URL in the code
We change this URL fairly frequently because we bump the version number. Let’s make it easier to change by only defining it once.
This commit is contained in:
@@ -17,7 +17,11 @@ from app.main import main
|
||||
from app.main.forms import FieldWithNoneOption, SearchByNameForm
|
||||
from app.main.views.feedback import QUESTION_TICKET_TYPE
|
||||
from app.main.views.sub_navigation_dictionaries import features_nav, pricing_nav
|
||||
from app.utils import get_logo_cdn_domain, user_is_logged_in
|
||||
from app.utils import (
|
||||
LETTER_SPECIFICATION_URL,
|
||||
get_logo_cdn_domain,
|
||||
user_is_logged_in,
|
||||
)
|
||||
|
||||
|
||||
@main.route('/')
|
||||
@@ -269,6 +273,7 @@ def features_sms():
|
||||
def features_letters():
|
||||
return render_template(
|
||||
'views/features/letters.html',
|
||||
letter_specification_url=LETTER_SPECIFICATION_URL,
|
||||
navigation_links=features_nav()
|
||||
)
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ from app.s3_client.s3_letter_upload_client import (
|
||||
)
|
||||
from app.template_previews import TemplatePreview, sanitise_letter
|
||||
from app.utils import (
|
||||
LETTER_SPECIFICATION_URL,
|
||||
generate_next_dict,
|
||||
generate_previous_dict,
|
||||
get_letter_validation_error,
|
||||
@@ -65,6 +66,7 @@ def uploads(service_id):
|
||||
prev_page=prev_page,
|
||||
next_page=next_page,
|
||||
scheduled_jobs='',
|
||||
letter_specification_url=LETTER_SPECIFICATION_URL,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<h3 class="heading heading-small" id="upload-letters">Upload your own letters</h3>
|
||||
<p>You can create reusable letter templates in Notify, or upload and send your own letters with the Notify API.</p>
|
||||
<p>Use the <a href="https://docs.notifications.service.gov.uk/documentation/images/notify-pdf-letter-spec-v2.4.pdf">letter specification document</a> to help you set up your letter, save it as a PDF, then upload it to Notify.<p>
|
||||
<p>Use the <a href="{{ letter_specification_url }}">letter specification document</a> to help you set up your letter, save it as a PDF, then upload it to Notify.<p>
|
||||
<p>Read our <a href="{{ url_for('.documentation') }}">API documentation</a> for more information.</p>
|
||||
|
||||
<h2 class="heading heading-medium">Pricing</h2>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
)}}
|
||||
</p>
|
||||
<p>You can upload a single letter as a PDF.</p>
|
||||
<p>Your file must meet our <a href="https://docs.notifications.service.gov.uk/documentation/images/notify-pdf-letter-spec-v2.4.pdf">letter specification</a>.</p>
|
||||
<p>Your file must meet our <a href="{{ letter_specification_url }}">letter specification</a>.</p>
|
||||
<p>To help you set up your letter you can download a <a href="https://docs.notifications.service.gov.uk/documentation/images/notify-pdf-letter-word-template-v1.0.docx">Word document template</a>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
15
app/utils.py
15
app/utils.py
@@ -566,21 +566,25 @@ def get_letter_printing_statement(status, created_at):
|
||||
return 'Printed on {} at 5:30pm'.format(printed_date)
|
||||
|
||||
|
||||
LETTER_SPECIFICATION_URL = (
|
||||
'https://docs.notifications.service.gov.uk'
|
||||
'/documentation/images/notify-pdf-letter-spec-v2.4.pdf'
|
||||
)
|
||||
|
||||
|
||||
LETTER_VALIDATION_MESSAGES = {
|
||||
'letter-not-a4-portrait-oriented': {
|
||||
'title': 'Your letter is not A4 portrait size',
|
||||
'detail': (
|
||||
'You need to change the size or orientation of {invalid_pages}. <br>'
|
||||
'Files must meet our <a href="https://docs.notifications.service.gov.uk/documentation/images/'
|
||||
'notify-pdf-letter-spec-v2.4.pdf" target="_blank">letter specification</a>.'
|
||||
f'Files must meet our <a href="{LETTER_SPECIFICATION_URL}" target="_blank">letter specification</a>.'
|
||||
),
|
||||
},
|
||||
'content-outside-printable-area': {
|
||||
'title': 'Your content is outside the printable area',
|
||||
'detail': (
|
||||
'You need to edit {invalid_pages}.<br>'
|
||||
'Files must meet our <a href="https://docs.notifications.service.gov.uk/documentation/images/'
|
||||
'notify-pdf-letter-spec-v2.4.pdf" target="_blank">letter specification</a>.'
|
||||
f'Files must meet our <a href="{LETTER_SPECIFICATION_URL}" target="_blank">letter specification</a>.'
|
||||
),
|
||||
},
|
||||
'letter-too-long': {
|
||||
@@ -604,8 +608,7 @@ LETTER_VALIDATION_MESSAGES = {
|
||||
'title': 'The address block is empty',
|
||||
'detail': (
|
||||
'You need to add a recipient address.<br>'
|
||||
'Files must meet our <a href="https://docs.notifications.service.gov.uk/documentation/images/'
|
||||
'notify-pdf-letter-spec-v2.4.pdf" target="_blank">letter specification</a>.'
|
||||
f'Files must meet our <a href="{LETTER_SPECIFICATION_URL}" target="_blank">letter specification</a>.'
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user