Add hidden text for pills on job page

The links in the blue boxes on the job page needed hidden text so that
they work out of context. This changes the text from "10 sending" to "10
sending text messages" (with the message type hidden text).
This commit is contained in:
Katie Smith
2021-02-24 14:34:56 +00:00
parent 6512b8fad3
commit 82318387de
3 changed files with 17 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ from app import (
notification_api_client,
service_api_client,
)
from app.formatters import get_time_left
from app.formatters import get_time_left, message_count_noun
from app.main import main
from app.main.forms import SearchNotificationsForm
from app.models.job import Job
@@ -336,6 +336,7 @@ def get_status_filters(service, message_type, statistics):
def _get_job_counts(job):
job_type = job.template_type
return [
(
label,
@@ -349,19 +350,27 @@ def _get_job_counts(job):
count
) for label, query_param, count in [
[
'total', '',
f'''total<span class="govuk-visually-hidden">
{message_count_noun(job.notification_count, job_type)}</span>''',
'',
job.notification_count
],
[
'sending', 'sending',
f'''sending<span class="govuk-visually-hidden">
{message_count_noun(job.notifications_sending, job_type)}</span>''',
'sending',
job.notifications_sending
],
[
'delivered', 'delivered',
f'''delivered<span class="govuk-visually-hidden">
{message_count_noun(job.notifications_delivered, job_type)}</span>''',
'delivered',
job.notifications_delivered
],
[
'failed', 'failed',
f'''failed<span class="govuk-visually-hidden">
{message_count_noun(job.notifications_failed, job_type)}</span>''',
'failed',
job.notifications_failed
]
]