Merge pull request #2536 from GSA/2123-back-button-context

2123 back button context
This commit is contained in:
Beverly Nguyen
2025-05-01 09:48:50 -07:00
committed by GitHub
12 changed files with 155 additions and 67 deletions

View File

@@ -1,3 +1,3 @@
{% macro usaBackLink(params) %}
{%- include "./template.njk" -%}
{%- include "./template.njk" with context %}
{% endmacro %}

View File

@@ -1,4 +1,6 @@
<nav class="usa-breadcrumb" aria-label="Breadcrumb">
<a href="{{ params.href.url or params.href or '#' }}" class="usa-link usa-back-link display-inline-flex {{ params.classes or '' }}"
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}" {% endfor %}>{{ params.html | safe or params.href.text or 'Back' }}</a>
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}" {% endfor %}>
{{- params.html | safe or params.href.text or 'Back' -}}
</a>
</nav>

View File

@@ -12,7 +12,7 @@
{% block backLink %}
{{ usaBackLink({ "href": back_link }) }}
{{ usaBackLink(back_link) }}
{% endblock %}
{% block maincolumn_content %}

View File

@@ -13,7 +13,7 @@
{% block backLink %}
{{ usaBackLink({ "href": back_link_from_preview }) }}
{{ usaBackLink(back_link_from_preview) }}
{% endblock %}
{% block maincolumn_content %}

View File

@@ -11,7 +11,8 @@
{% block backLink %}
{{ usaBackLink({
"href": url_for('main.choose_template', service_id=current_service.id, template_folder_id=template_folder_id) if template_folder_id else url_for('main.choose_template', service_id=current_service.id)
"href": url_for('main.choose_template', service_id=current_service.id, template_folder_id=template_folder_id) if template_folder_id else url_for('main.choose_template', service_id=current_service.id),
"html": "Back to all templates"
}) }}
{% endblock %}

View File

@@ -9,7 +9,7 @@
{% endblock %}
{% block backLink %}
{{ usaBackLink({ "href": back_link }) }}
{{ usaBackLink(back_link) }}
{% endblock %}
{% block maincolumn_content %}

View File

@@ -16,9 +16,9 @@
{% block backLink %}
{% if help %}
{{ usaBackLink({ "href": back_link }) }}
{{ usaBackLink(back_link) }}
{% else %}
{{ usaBackLink({ "href": back_link_from_preview }) }}
{{ usaBackLink(back_link_from_preview) }}
{% endif %}
{% endblock %}

View File

@@ -10,7 +10,7 @@
{% endblock %}
{% block backLink %}
{{ usaBackLink({ "href": back_link }) }}
{{ usaBackLink(back_link) }}
{% endblock %}

View File

@@ -13,7 +13,8 @@
{% block backLink %}
{{ usaBackLink({
"href": url_for('main.send_one_off_step', service_id=current_service.id, template_id=template.id, step_index=0)
"href": url_for('main.send_one_off_step', service_id=current_service.id, template_id=template.id, step_index=0),
"html": "Back to select recipients"
}) }}
{% endblock %}