Skip to content

Commit

Permalink
Merge pull request #8454 from cfpb/ans_update_jump_links
Browse files Browse the repository at this point in the history
Standardize jump links
  • Loading branch information
anselmbradford authored Jun 4, 2024
2 parents b3e2565 + 5371007 commit 906dce5
Show file tree
Hide file tree
Showing 61 changed files with 422 additions and 375 deletions.
12 changes: 7 additions & 5 deletions cfgov/ask_cfpb/jinja2/ask-cfpb/answer-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,20 @@ <h3>{{ _('Browse related questions') }} </h3>
<ul class="m-list m-list--unstyled m-list--links">
{% for question in related_questions %}
<li class="m-list__item">
<a href="{{ question.url }}" class="m-list__link">
{{ question.question | safe }}
<a class="a-link a-link--jump"
href="{{ question.url }}">
<span class="a-link__text">{{ question.question | safe }}</span>
</a>
</li>
{% endfor %}
{% if portal_page %}
<li class="m-list__item m-list__item--last">
<a href="{{ portal_page.url }}" class="m-list__link">
<b>
<a class="a-link a-link--jump"
href="{{ portal_page.url }}">
<span class="a-link__text"><b>
{{ _('Learn more about') }}
{{ portal_page.portal_topic.title(page.language) | lower }}
</b>
</b></span>
</a>
</li>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions cfgov/core/tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def test_external_link_with_header(self):
def test_multiline_external_gov_link(self):
s = """
<body>
<a class="m-list__link a-link"
<a class="a-link a-link--jump"
href="https://usa.gov/">
<span>USA
<span class="a-link__text">USA
.gov</span>
</a>
</body>
Expand Down
6 changes: 3 additions & 3 deletions cfgov/core/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def check_external_link(self, url, expected_pretty_href=None):
data_pretty_href = f'data-pretty-href="{expected_pretty_href}" '

expected_html = (
'<a class="a-link a-link--icon" '
'<a class="a-link" '
f"{data_pretty_href}"
f'href="{url}">'
'<span class="a-link__text">foo</span> '
Expand Down Expand Up @@ -205,7 +205,7 @@ def test_external_link_if_link_already_includes_left_icon(self):
path = "/about-us/blog/"

expected_html = (
'<a class="a-link a-link--icon" '
'<a class="a-link" '
f'href="{url}">'
"<svg></svg>"
'<span class="a-link__text">foo</span> '
Expand Down Expand Up @@ -268,7 +268,7 @@ def test_link_with_whitespace_in_text(self):
path = "/about-us/blog/"

expected_html = (
f'<a class="a-link a-link--icon" href="{url}">'
f'<a class="a-link" href="{url}">'
'<span class="a-link__text">'
"Click <strong>here</strong> now!</span> "
f"{self.external_link_icon}"
Expand Down
4 changes: 2 additions & 2 deletions cfgov/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
r"(https?:\/\/(www\.)?(cfpb|consumerfinance)\.gov)?\/ask\-cfpb\/([-\w]{1,244})-(en)-(?P<ask_id>\d{1,6})\/?$" # noqa: E501
)

LINK_ICON_CLASSES = ["a-link", "a-link--icon"]
LINK_ICON_CLASSES = ["a-link"]

LINK_ICON_TEXT_CLASSES = ["a-link__text"]

Expand Down Expand Up @@ -180,7 +180,7 @@ def add_link_markup(tag, request_path):
# it has the proper non-button link classes, and then add the icon after
# the span.
else:
# Since we're adding an icon, also add class="a-link a-link_icon" to
# Since we're adding an icon, also add class="a-link" to
# the <a> tag. We don't do this if the link is a button.
for cls in LINK_ICON_CLASSES:
if cls not in class_attrs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ <h2 class="m-slug-header__heading">
</ul>
<ul class="m-list m-list--links">
<li class="m-list__item">
<a href="/about-us/diversity-and-inclusion/self-assessment-regulated-entities/" class="m-list__link">
Learn more about the Voluntary Diversity Self-Assessment
<a href="/about-us/diversity-and-inclusion/self-assessment-regulated-entities/"
class="a-link a-link--jump">
<span class="a-link__text">
Learn more about the Voluntary Diversity Self-Assessment
</span>
</a>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ <h3 class="report-header o-fig__heading">
<ul class="m-list m-list--links">
{% for field in data_fields %}
<li class="m-list__item">
<a class="m-list__link"
<a class="a-link a-link--jump"
href="#{{field.info.get('short_name', '')}}">
<span class="a-link__text">
Field {{ field.info.get('field_number', '') }}: {{ field.info.get('title', '') }}
</span>
</a>
</li>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<h1>{{ page.page_header }}</h1>
<div class="lead-paragraph">{{ page.subheader }}</div>
<div class="block block--border-top u-fig-print-link">
<a class="a-link a-link--icon" href="javascript:window.print()">
<a class="a-link" href="javascript:window.print()">
<span class="a-link__text">Print this guide</span>
{{ svg_icon('print') }}
</a>
Expand Down
15 changes: 7 additions & 8 deletions cfgov/housing_counselor/jinja2/housing_counselor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ <h1>Find a housing counselor</h1>
and Urban Development (HUD) and they can
offer independent advice, often at little or
no cost to you. There is also a
<a class="a-link a-link--icon"
href="https://www.hud.gov/program_offices/housing/sfh/hcc/hcc_home">
<a class="a-link"
href="https://www.hud.gov/program_offices/housing/sfh/hcc/hcc_home">
<span class="a-link__text">list of nationwide HUD-approved counseling agencies</span></a>.
</p>
<p>
Expand Down Expand Up @@ -120,7 +120,7 @@ <h1>Find a housing counselor</h1>
<div class="m-form-field-with-button__info">
<p>
This tool is powered by
<a class="a-link a-link--icon"
<a class="a-link"
href="https://data.hud.gov/housing_counseling.html">
<span class="a-link__text">HUD's</span>
{{ svg_icon('external-link') }}</a>
Expand Down Expand Up @@ -165,16 +165,15 @@ <h1>Find a housing counselor</h1>
m-list--horizontal
hud-hca-api-results-actions">
<li class="m-list__item">
<a class="a-link
a-link--icon"
<a class="a-link"
id="hud_print-page-link"
href="#">
<span class="a-link__text">Print list</span>
{{ svg_icon('print') }}
</a>
</li>
<li class="m-list__item">
<a class="a-link a-link--icon"
<a class="a-link"
id="generate-pdf-link"
href="{{ pdf_url }}"
target="_blank"
Expand Down Expand Up @@ -214,7 +213,7 @@ <h2 class="h4">
itemtype="https://schema.org/PostalAddress">

{% if counselor.weburl %}
<a class="a-link a-link--icon"
<a class="a-link"
href="{{ counselor.weburl }}">
<span class="a-link__text"><b itemprop="name">{{ counselor.nme }}</b></span>
{{ svg_icon('external-link') }}
Expand All @@ -241,7 +240,7 @@ <h2 class="h4">
{% if counselor.weburl %}
<dt>Website:</dt>
<dd>
<a class="a-link a-link--icon"
<a class="a-link"
href="{{ counselor.weburl }}"
itemprop="url">
<span class="a-link__text">{{ counselor.weburl }}</span>
Expand Down
23 changes: 8 additions & 15 deletions cfgov/jinja2/know-before-you-owe/compare/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ <h1>How we improved the disclosures</h1>

<ul class="m-list m-list--links">
<li class="m-list__item">
<a class="a-link
a-link--icon
m-list__link"
<a class="a-link a-link--jump"
href="https://files.consumerfinance.gov/f/201207_cfpb_report_tila-respa-testing.pdf">
<span class="a-link__text">
Read a report on our qualitative testing of the new disclosures
Expand All @@ -47,9 +45,7 @@ <h1>How we improved the disclosures</h1>
</a>
</li>
<li class="m-list__item">
<a class="a-link
a-link--icon
m-list__link"
<a class="a-link a-link--jump"
href="https://files.consumerfinance.gov/f/201311_cfpb_report_tila-respa_testing-spanish-refinancing.pdf">
<span class="a-link__text">
Read a report on our post-proposal qualitative testing of the new Spanish and refinance disclosures
Expand All @@ -58,9 +54,7 @@ <h1>How we improved the disclosures</h1>
</a>
</li>
<li class="m-list__item">
<a class="a-link
a-link--icon
m-list__link"
<a class="a-link a-link--jump"
href="https://files.consumerfinance.gov/f/201311_cfpb_study_tila-respa_disclosure-comparison.pdf">
<span class="a-link__text">
Read a report on our quantitative testing of the new disclosures
Expand All @@ -69,8 +63,7 @@ <h1>How we improved the disclosures</h1>
</a>
</li>
<li class="m-list__item">
<a class="a-link
m-list__link"
<a class="a-link a-link--jump"
href="/regulations/integrated-mortgage-disclosures-under-the-real-estate-settlement-procedures-act-regulation-x-and-the-truth-in-lending-act-regulation-z/">
<span class="a-link__text">
Read a detailed summary of the final rule
Expand All @@ -96,7 +89,7 @@ <h3>Initial TIL disclosure + Good Faith Estimate</h3>
<img src="https://files.consumerfinance.gov/f/201207_cfpb_img_t-gfe3.png" alt="Loan estimate, before, Good Faith Estimate, page 3" title="Click to enlarge"> </a>
</div>
<p>
<a href="https://files.consumerfinance.gov/f/201207_combined_til_gfe.pdf" class="a-link a-link--jump a-link--icon-after-text">
<a href="https://files.consumerfinance.gov/f/201207_combined_til_gfe.pdf" class="a-link a-link--jump">
<span class="a-link__text">View these two forms as a PDF</span></a>
</p>
</div>
Expand All @@ -113,7 +106,7 @@ <h3>Loan Estimate</h3>
<img src="https://files.consumerfinance.gov/f/201311_cfpb_le_small_page3.png" alt="Loan Estimate page 3" title="Click to enlarge"> </a>
</div>
<p>
<a href="https://files.consumerfinance.gov/f/201311_cfpb_kbyo_loan-estimate.pdf" class="a-link a-link--jump a-link--icon-after-text">
<a href="https://files.consumerfinance.gov/f/201311_cfpb_kbyo_loan-estimate.pdf" class="a-link a-link--jump">
<span class="a-link__text">View the Loan Estimate as a PDF</span></a>
</p>
</div>
Expand All @@ -136,7 +129,7 @@ <h3>Final TIL disclosure + HUD-1 Settlement Statement</h3>
<img src="https://files.consumerfinance.gov/f/201207_cfpb_img_t-hud1_3.png" alt="Closing disclosure, before, HUD-1, page 3" title="Click to enlarge"> </a>
</div>
<p>
<a href="https://files.consumerfinance.gov/f/201207_combined_til_hud1.pdf" class="a-link a-link--jump a-link--icon-after-text">
<a href="https://files.consumerfinance.gov/f/201207_combined_til_hud1.pdf" class="a-link a-link--jump">
<span class="a-link__text">View these two forms as a PDF</span></a>
</p>
</div>
Expand All @@ -156,7 +149,7 @@ <h3>Closing Disclosure</h3>
<img src="https://files.consumerfinance.gov/f/201311_cfpb_cd_small_page5.png" alt="Closing Disclosure page 5" title="Click to enlarge"> </a>
</div>
<p>
<a href="https://files.consumerfinance.gov/f/201311_cfpb_kbyo_closing-disclosure.pdf" class="a-link a-link--jump a-link--icon-after-text">
<a href="https://files.consumerfinance.gov/f/201311_cfpb_kbyo_closing-disclosure.pdf" class="a-link a-link--jump">
<span class="a-link__text">View the Closing Disclosure as a PDF</span></a>
</p>
</div>
Expand Down
Loading

0 comments on commit 906dce5

Please sign in to comment.