mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
Make text of ‘send’ button say ‘email’ or ‘text…’
Previously the send button on the ‘Check and confirm’ page always said ‘Send x messages’, irrespective of whether you were sending emails or text messages. This commit makes it say one of - Send 1 email - Send 29 emails - Send 1 text message - Send 999 text messages
This commit is contained in:
@@ -43,6 +43,19 @@ manage_templates_page_headings = {
|
||||
}
|
||||
|
||||
|
||||
def get_send_button_text(template_type, number_of_messages):
|
||||
if 1 == number_of_messages:
|
||||
return {
|
||||
'email': 'Send 1 email',
|
||||
'sms': 'Send 1 text message'
|
||||
}[template_type]
|
||||
else:
|
||||
return {
|
||||
'email': 'Send {} emails',
|
||||
'sms': 'Send {} text messages'
|
||||
}[template_type].format(number_of_messages)
|
||||
|
||||
|
||||
def get_page_headings(template_type):
|
||||
# User has manage_service role
|
||||
if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters']):
|
||||
@@ -235,6 +248,7 @@ def check_messages(service_id, upload_id):
|
||||
count_of_recipients=session['upload_data']['notification_count'],
|
||||
count_of_displayed_recipients=len(list(recipients.rows_annotated_and_truncated)),
|
||||
original_file_name=session['upload_data'].get('original_file_name'),
|
||||
send_button_text=get_send_button_text(template.template_type, session['upload_data']['notification_count']),
|
||||
service_id=service_id,
|
||||
service=service,
|
||||
form=CsvUploadForm()
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
{% else %}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="button" value="{{ "Send {} message{}".format(count_of_recipients, '' if count_of_recipients == 1 else 's') }}" />
|
||||
<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>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user