Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ module.exports = {
'**/compiled/**',
'**/coverage/**',
'**/staticfiles/**',
'htmlcov/**',
'.mypy_cache/**',

// Enable dotfile linting
'!.*',
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ manage_breast_screening/static
# Files that aren't checked in
.pytest_cache
.terraform
htmlcov/
.mypy_cache/
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ test-lint: # Lint files @Testing
npm run lint
poetry run ruff check manage_breast_screening

# Enable this once we have fixed all the issues
# make test-lint-templates

test-lint-templates: # Lint just the templates @Testing
poetry run djlint -e jinja --lint --profile jinja manage_breast_screening

test-ui: # Run UI tests @Testing
poetry run pytest -m system --ignore manage_breast_screening/notifications

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.special-appointment-banner__action {
.app-special-appointment-banner__action {
text-align: right;
@include nhsuk-font-size(19);
}

.special-appointment-banner__no-details {
.app-special-appointment-banner__tag--no-details {
color: $nhsuk-secondary-text-color;
}

.special-appointment-banner__temporary {
.app-special-appointment-banner__tag--temporary {
@extend .nhsuk-tag;
@extend .nhsuk-tag--white;
margin-top: nhsuk-spacing(2);
Expand Down
4 changes: 0 additions & 4 deletions manage_breast_screening/assets/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ h3 {
@extend %nhsuk-heading-s;
}

.app-text-grey {
color: $nhsuk-secondary-text-color;
}

[hidden] {
display: none;
}
Expand Down
4 changes: 2 additions & 2 deletions manage_breast_screening/clinics/jinja2/clinics/index.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<td>
{{ presented_clinic.type }}
<br>
<span class="app-text-grey">{{ presented_clinic.risk_type }}</span>
<span class="nhsuk-u-secondary-text-color">{{ presented_clinic.risk_type }}</span>
</td>

<td class="nhsuk-table__cell--numeric">
Expand All @@ -77,4 +77,4 @@
</table>

{% endif %}
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion manage_breast_screening/clinics/jinja2/clinics/show.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{{ presented_appointment.participant.full_name }}
</a>
</p>
<p class="app-text-grey nhsuk-u-margin-bottom-0">
<p class="nhsuk-u-secondary-text-color nhsuk-u-margin-bottom-0">
NHS: {{ presented_appointment.participant.nhs_number }}
</p>
{% endset %}
Expand Down
8 changes: 5 additions & 3 deletions manage_breast_screening/config/jinja2_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ def nl2br(value):

def as_hint(value):
"""
Wrap a string in a span with class app-text-grey
Wrap a string in a span with class nhsuk-u-secondary-text-color

>>> as_hint('Not provided')
Markup('<span class="app-text-grey">Not provided</span>')
Markup('<span class=nhsuk-u-secondary-text-color">Not provided</span>')
"""
return Markup(f'<span class="app-text-grey">{value}</span>' if value else "")
return Markup(
f'<span class=nhsuk-u-secondary-text-color">{value}</span>' if value else ""
)


def raise_helper(msg):
Expand Down
5 changes: 5 additions & 0 deletions manage_breast_screening/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from unittest import TestCase

import pytest
from django.contrib.auth import get_user_model

# Show long diffs in failed test output
TestCase.maxDiff = None


@pytest.fixture
def user():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% set clinic_slot = appointment.clinic_slot %}
{% set participant = appointment.participant %}

<p class="app-text-grey"><span>NHS Number: {{ participant.nhs_number }}</span></p>
<p class="nhsuk-u-secondary-text-color"><span>NHS Number: {{ participant.nhs_number }}</span></p>

<p>{{ clinic_slot.slot_time_and_clinic_date }}{% if not appointment.current_status.is_screened %}<span class="nhsuk-u-margin-left-3"><a href="#">Reschedule appointment</a></span>{% endif %}</p>

Expand Down
12 changes: 7 additions & 5 deletions manage_breast_screening/core/tests/services/test_auditor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest
from django.test import RequestFactory

from manage_breast_screening.clinics.models import Provider
from manage_breast_screening.clinics.tests.factories import ProviderFactory
from manage_breast_screening.core.services.auditor import Auditor
from manage_breast_screening.participants.models import Participant
from manage_breast_screening.participants.tests.factories import ParticipantFactory
Expand Down Expand Up @@ -52,18 +54,18 @@ def test_audit_update(self):

def test_audit_delete(self):
auditor = Auditor(system_update_id="test")
participant = ParticipantFactory.create()
pk = participant.pk
address = ProviderFactory.create()
pk = address.pk

# audit_delete must be called before the record is deleted
log = auditor.audit_delete(participant)
log = auditor.audit_delete(address)

participant.delete()
address.delete()
log.refresh_from_db()

assert log.system_update_id == "test"
assert log.operation == "delete"
assert log.content_type.model_class() == Participant
assert log.content_type.model_class() == Provider
assert log.object_id == pk

def test_audit_bulk_create(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
{% if reason.details %}
{% set value_content = reason.details %}
{% else %}
{% set value_content = "<span class=\"special-appointment-banner__no-details\">No details provided</span>" %}
{% set value_content = "<span class=\"app-special-appointment-banner__tag--no-details\">No details provided</span>" %}
{% endif %}

{# Add temporary tag to the value content if needed #}
{% if reason.temporary %}
{% set value_content = value_content + "<br><span class=\"special-appointment-banner__temporary\">Temporary</span>" %}
{% set value_content = value_content + "<br><span class=\"app-special-appointment-banner__tag--temporary\">Temporary</span>" %}
{% endif %}

{# Add row for this support reason #}
Expand All @@ -30,10 +30,10 @@
{% endfor %}
{{ summaryList({
"rows": rows,
"classes": "special-appointment-banner"
"classes": "app-special-appointment-banner"
}) }}
{% if show_change_link %}
<div class="special-appointment-banner__action">
<div class="app-special-appointment-banner__action">
<a href="{{ presented_special_appointment.change_url }}" style="font-size: 19px;">Change<span class="nhsuk-u-visually-hidden"> special appointment requirements</span></a>
</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ def test_special_appointment_banner_with_change_link(jinja_env, presenter):
Special appointment
</span></h3>

<dl class="nhsuk-summary-list nhsuk-summary-list">
<dl class="nhsuk-summary-list app-special-appointment-banner">
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key">
Physical restriction
</dt>
<dd class="nhsuk-summary-list__value">
broken foot<br><span class="nhsuk-tag nhsuk-tag--white nhsuk-u-margin-top-2">Temporary</span>
broken foot<br><span class="app-special-appointment-banner__tag--temporary">Temporary</span>
</dd>
</div>
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key">
Social, emotional, and mental health
</dt>
<dd class="nhsuk-summary-list__value">
<span style="color: var(--nhsuk-secondary-text-color);">No details provided</span>
<span class="app-special-appointment-banner__tag--no-details">No details provided</span>
</dd>
</div>
</dl>
<div style="text-align: right;">
<div class="app-special-appointment-banner__action">
<a href="/mammograms/68d758d0-792d-430f-9c52-1e7a0c2aa1dd/special-appointment/" style="font-size: 19px;">Change<span class="nhsuk-u-visually-hidden"> special appointment requirements</span></a>
</div>
</div>
Expand Down Expand Up @@ -85,21 +85,21 @@ def test_special_appointment_banner_without_change_link(jinja_env, presenter):
Special appointment
</span></h3>

<dl class="nhsuk-summary-list nhsuk-summary-list">
<dl class="nhsuk-summary-list app-special-appointment-banner">
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key">
Physical restriction
</dt>
<dd class="nhsuk-summary-list__value">
broken foot<br><span class="nhsuk-tag nhsuk-tag--white nhsuk-u-margin-top-2">Temporary</span>
broken foot<br><span class="app-special-appointment-banner__tag--temporary">Temporary</span>
</dd>
</div>
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key">
Social, emotional, and mental health
</dt>
<dd class="nhsuk-summary-list__value">
<span style="color: var(--nhsuk-secondary-text-color);">No details provided</span>
<span class="app-special-appointment-banner__tag--no-details">No details provided</span>
</dd>
</div>
</dl>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% from "card/macro.jinja" import card %}
{% from "tag/macro.jinja" import tag %}

{% macro appointment_table(presented_appointments, testid) %}
<table class="nhsuk-table" data-testid="{{ testid }}">
<thead>
<tr>
<th>Date</th>
<th>Type</th>
<th>Location</th>
<th>Status</th>
<th>Details</th>
</tr>
</thead>
<tbody>
{% for presented_appointment in presented_appointments %}
<tr data-testid="appointment-row">
<td>{{ presented_appointment.starts_at }}</td>
<td>{{ presented_appointment.clinic_type }}</td>
<td>{{ presented_appointment.setting_name }}</td>
<td>
{{ tag({
"text": presented_appointment.status.text,
"classes": presented_appointment.status.classes
}) }}
</td>
<td>
<a href="{{ presented_appointment.url }}">
View details
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}

{% macro appointments(presented_appointments) %}
{% call card({
"heading": "Appointments",
"headingLevel": "2"
}) %}
{% if presented_appointments.upcoming %}
<h3>Upcoming</h3>
{{ appointment_table(presented_appointments.upcoming, testid="upcoming-appointments-table") }}
{% endif %}

{% if presented_appointments.past %}
<h3>Previous</h3>
{{ appointment_table(presented_appointments.past, testid="past-appointments-table") }}
{% endif %}

{% if not presented_appointments.past and not presented_appointments.upcoming %}
<p>No screening history found</p>
{% endif %}
{% endcall %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% from "card/macro.jinja" import card %}
{% from "summary-list/macro.jinja" import summaryList %}

{% macro contact_details(presented_participant) %}
{% set address_html %}
{% if presented_participant.address %}
{% for line in presented_participant.address.lines %}
Comment thread
MatMoore marked this conversation as resolved.
{{ line }}{% if not loop.last %}<br>{% endif %}
{% endfor %}
{% if presented_participant.address.postcode %}
<br>{{ presented_participant.address.postcode }}
{% endif %}
{% endif %}
{% endset %}
{% call card({
"heading": "Contact details"
}) %}
{{ summaryList({
"rows": [
{
"key": {
"text": "Address"
},
"value": {
"html": address_html
}
},
Comment on lines +20 to +27
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NHS summary list guidance wasn't updated with Showing missing information (GOV.UK) but what if the address is empty here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for phone and email I suppose

Copy link
Copy Markdown
Contributor Author

@MatMoore MatMoore Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I'll park this one as well, we've got tickets to add the edit forms, so when that is done we will be linking to those.

{
"key": {
"text": "Phone"
},
"value": {
"html": presented_participant.phone
}
},
{
"key": {
"text": "Email"
},
"value": {
"html": presented_participant.email
}
}
]
}) }}
{% endcall %}
{% endmacro %}
Loading