Fix links to current service pages from guidance

This wasn’t working because:
- macros don’t have access to `current_service` from within their scope
- there were no tests for this behaviour
This commit is contained in:
Chris Hill-Scott
2020-02-20 15:11:10 +00:00
parent e49d665c44
commit 75927a8d05
6 changed files with 45 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
{% macro current_service_link(endpoint, link_text) %}
{% if current_service %}
<a class="govuk-link" href="{{ url_for(endpoint, service_id=current_service.id) }}">{{ link_text }}</a>
{% macro service_link(service, endpoint, link_text) %}
{% if service %}
<a class="govuk-link" href="{{ url_for(endpoint, service_id=service.id) }}">{{ link_text }}</a>
{% else %}
<b class="govuk-!-font-weight-bold">{{ link_text|capitalize }}</b>
{% endif %}