Skip to content

Commit

Permalink
Merge branch 'dev' into pxbf-release-v0.7.0.beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
scottqueen-bixal authored Oct 7, 2024
2 parents afcabdc + 7cc4dba commit 898e826
Show file tree
Hide file tree
Showing 30 changed files with 321 additions and 460 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
"Add a taxonomy revision UI": "https://www.drupal.org/files/issues/2023-10-26/add-taxonomy-revision-ui-2936995-58.patch",
"Enable taxonomy revision log message": "./patches/drupal/taxonomy_revision_log.patch"
},
"drupal/autologout": {
"Autologout can log out out from other tabs": "https://www.drupal.org/files/issues/2024-06-03/3395581-7.patch"
},
"drupal/views_menu_children_filter": {
"Use the technique from correctActiveTrail.patch to return the original menu item": "./patches/drupal/correctMenuChildren_d10.patch"
}
Expand Down
2 changes: 1 addition & 1 deletion docs/HomePage.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Taxonomy terms are content in drupal and if not already in database need to be m
**Note** --> If homepage banner does not show after doing the above, refresh the page. The image styles may not have loaded. Similarly if you change the size of your window you may need to refresh. This should not be an issue on dev, stage or prod as tome will create the necessary files for the static site. If however you still do not see the banner go to content -> media -> media library. Try and upload media there. If it works there is a bug somewhere else in the code. If it does not there is an issue with media in general on the site and should be fixed by creating a new ticket for it.

# Code Organization
The homepage is currently in node--1--full.html.twig. Page.html.twig checks if the term_name is "Home Page" and if so in calls `<main class="main-content usa-layout-docs {{ main_classes }}" role="main" id="main-content" data-pagetype="{{term_name}}">
The homepage is currently in node--1--full.html.twig. Page.html.twig checks if the term_name is "Home Page" and if so in calls `<main class="main-content usa-layout-docs {{ main_classes }}" id="main-content" data-pagetype="{{term_name}}">
{{ page.content }}`
This is because the other pages are wrapped in a `grid-container` which does not allow for full page spanning.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<div class="usa-overlay"></div>

<header class="{{ header_classes }}" id="header" role="banner">
<header class="{{ header_classes }}" id="header">

{% if page.header_top %}
<div class="usa-banner-inner">
Expand Down Expand Up @@ -112,7 +112,7 @@
{% endif %}
{% if term_name != "Home Page" %}

<main class="main-content usa-layout-docs usa-section {{ main_classes }}" role="main" id="main-content" data-pagetype="{{term_name}}">
<main class="main-content usa-layout-docs usa-section {{ main_classes }}" id="main-content" data-pagetype="{{term_name}}">

{# link is in html.html.twig #}
<div hidden><a href="{{ json_data_file_path }}" rel="noindex nofollow">"{{ json_data_file_path }}"</a></div>
Expand All @@ -125,7 +125,7 @@
</div>

{% else %}
<main class="main-content usa-layout-docs no-footer-gap {{ main_classes }}" role="main" id="main-content" data-pagetype="{{term_name}}">
<main class="main-content usa-layout-docs no-footer-gap {{ main_classes }}" id="main-content" data-pagetype="{{term_name}}">

{{ page.content }}
{% endif %}
Expand Down
20 changes: 15 additions & 5 deletions web/themes/custom/usagov/scripts/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ async function handleFormSubmission() {
const stateField = document.getElementById("input-state");
const zipCodeField = document.getElementById("input-zip");
const formFields = [streetAddressField, cityField, stateField, zipCodeField];

// Analyze the response and decide if the address is valid or not.
const uspsApiResponse = await addressUSPSValidation(streetAddressField.value, cityField.value, stateField.value, zipCodeField.value);
const response = uspsResponseParser(uspsApiResponse, streetAddressField.value, cityField.value, zipCodeField.value);
Expand Down Expand Up @@ -374,16 +373,27 @@ window.addEventListener("load", function () {
"use strict";

let clearButtonWrappers = document.getElementsByClassName("usa-combo-box__clear-input__wrapper");
for (let i = 0; i < clearButtonWrappers.length; i++) {
clearButtonWrappers[i].remove();
for (const clearButtonWrapper of clearButtonWrappers) {
clearButtonWrapper.remove();
}

// Include the dropdown menu's toggle button in the tab order
let toggleButtons = document.getElementsByClassName("usa-combo-box__toggle-list");
for (let i = 0; i < toggleButtons.length; i++) {
toggleButtons[i].removeAttribute("tabindex");
for (const toggleButton of toggleButtons) {
toggleButton.removeAttribute("tabindex");
}


// Code for autocomplete state fields
let isChromeOrEdge = navigator.userAgent.includes("Chrome");
// Change attributes so that autofill works in state input
if (isChromeOrEdge) {
let stateSelectBox = document.getElementsByName("select-dropdown")[0];
stateSelectBox.setAttribute("autocomplete","country");

let stateInputBox = document.getElementById("input-state");
stateInputBox.setAttribute("autocomplete","address-level1");
}
});

(function() {
Expand Down
4 changes: 2 additions & 2 deletions web/themes/custom/usagov/scripts/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,9 @@ function load() {

let inputStreet = searchParams.get('input-street');
let inputCity = searchParams.get('input-city');
let inputState = searchParams.get('input-state');
let inputZip = searchParams.get('input-zip');
let inputState = searchParams.get('select-dropdown');

let inputZip = searchParams.get('input-zip');
let normalizedAddress = inputStreet + ", " + inputCity + ", " + inputState + " " + inputZip;
let displayAddress = document.getElementById("display-address");
displayAddress.innerHTML = DOMPurify.sanitize(normalizedAddress.replace(", ", "<br>"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'search_placeholder': 'Busque en este sitio...',
'search_affiliate': 'usagov_es_internal',
'all_topics': 'Todos los temas y servicios',
'phone_URL': '/es/centro-de-llamadas',
'phone_URL': '/es/llamenos',
'form_id':'usagov_es_internal-mobile'
} %}
{% else %}
Expand Down Expand Up @@ -133,18 +133,18 @@


{# Build the mobile menu #}
<nav aria-label={{ node.langcode.langcode == 'es' ? "Navegación primaria" : "Primary navigation" }} class="usa-nav usagov-mobile-menu">
<nav aria-label="{{ node.langcode.langcode == 'es' ? "Navegación primaria" : "Primary navigation" }}" class="usa-nav usagov-mobile-menu">
<div class="usa-nav__inner">
<div class="usagov-mobile-menu-top">
<div class="usagov-mobile-menu-controls">
<a id="home-link-mobile-menu" href="{{ translations.home_URL }}">
<svg class="usa-icon text-base-darkest" alt=" ">
<svg class="usa-icon text-base-darkest">
<use xlink:href="/themes/custom/usagov/assets/img/sprite.svg#home"></use>
</svg>
{{ translations.home }}
</a>
<button class="usa-nav__close">
<svg class="usa-icon text-base-darkest" alt=" ">
<svg class="usa-icon text-base-darkest">
<use xlink:href="/themes/custom/usagov/assets/img/sprite.svg#highlight_off"></use>
</svg>
{{ translations.close }}
Expand Down
97 changes: 57 additions & 40 deletions web/themes/custom/usagov/templates/breadcrumb.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,65 @@
*/
#}
{% if path('<current>') matches '#\/agencies\/*#'%}
{% include directory ~ '/templates/includes/breadcrumbs_for_agencies.html.twig' %}

{% set breadcrumb = [
{ 'url': "/", 'text': 'Home' },
{ 'url': "/about-the-us", 'text': 'About the U.S. and its government' },
{ 'url': '/agency-index', 'text': drupal_field('title', 'node', 629) },
{ 'text': drupal_title() }
] %}
{% elseif path('<current>') matches '#\/states\/*#' %}
{% include directory ~ '/templates/includes/breadcrumbs_for_states.html.twig' %}


{% elseif path('<current>') == '/es/indice-agencias' or path('<current>') matches '#\/es\/agencias\/*#' %}
{% include directory ~ '/templates/includes/breadcrumbs_for_es_agencies.html.twig' %}
{% set breadcrumb = [
{ 'url': "/", 'text': 'Home' },
{ 'url': "/about-the-us", 'text': 'About the U.S. and its government' },
{ 'url': "/state-governments", 'text': 'State governments' },
{ 'text': drupal_title() }
] %}
{% elseif path('<current>') matches '#\/es\/agencias\/*#' %}
{% set breadcrumb = [
{ 'url': "/es", 'text': 'Página principal' },
{ 'url': "/es/acerca-de-estados-unidos", 'text': 'Acerca de EE. UU. y su Gobierno' },
{ 'url': '/es/indice-agencias', 'text': drupal_field('title', 'node', 1696) },
{ 'text': drupal_title() }
] %}
{% elseif path('<current>') matches '#\/es\/estados\/*#' %}
{% set breadcrumb = [
{ 'url': "/es", 'text': 'Página principal' },
{ 'url': "/es/acerca-de-estados-unidos", 'text': 'Acerca de EE. UU. y su Gobierno' },
{ 'url': "/es/gobiernos-estatales", 'text': 'Gobiernos estatales' },
{ 'text': drupal_title() }
] %}
{% endif %}

{% if breadcrumb %}

{% elseif path('<current>') matches '#\/estados\/*#' %}
{% include directory ~ '/templates/includes/breadcrumbs_for_es_states.html.twig' %}
<nav class="margin-top-neg-3
mobile-lg:margin-top-2
tablet:margin-top-neg-3
desktop:margin-top-0
margin-bottom-2
mobile-lg:margin-bottom-6"
aria-label="Breadcrumb">

<ol class="usa-breadcrumb__list" itemscope itemtype="http://schema.org/BreadcrumbList">
{% for item in breadcrumb %}
<li class="usa-breadcrumb__list-item {{ item.url ? '' : 'usa-breadcrumb__currrent' }}" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
{% if item.url %}
<a href="{{ item.url }}" class="usa-breadcrumb__link" itemprop="item">
<span itemprop="name">
{% if item.url == '/es' %}
Página principal
{% else %}
{{ item.text }}
{% endif %}
</span>
</a>
{% else %}
<span itemprop="name">{{ item.text }}</span>
{% endif %}
<meta itemprop="position" content="{{loop.index}}" />
</li>
{% endfor %}
</ol>
</nav>

{% else %}
{% if breadcrumb %}
<nav class="margin-top-neg-3
mobile-lg:margin-top-2
tablet:margin-top-neg-3
desktop:margin-top-0
margin-bottom-2
mobile-lg:margin-bottom-6"
role="navigation"
aria-label="Breadcrumb"
>
{% block content %}
<ol class="usa-breadcrumb__list" itemscope itemtype="http://schema.org/BreadcrumbList">
{% for item in breadcrumb %}
<li class="usa-breadcrumb__list-item {{ item.url ? '' : 'usa-breadcrumb__currrent' }}" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
{% if item.url %}
<a href="{{ item.url }}" class="usa-breadcrumb__link" itemprop="item">
<span itemprop="name">
{% if item.url == '/es' %}
Página principal
{% else %}{{ item.text }}{% endif %}</span></a>
{% else %}
<span itemprop="name">{{ item.text }}</span>
{% endif %}
<meta itemprop="position" content="{{loop.index}}" />
</li>
{% endfor %}
</ol>
{% endblock %}
</nav>
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{#
/**
* This overrides the default template which added a <div> inside of a <button> which is not valid HTML
*/
#}

{% block content %}
{{ items[0].content }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{#
/**
* This overrides the default template which added a <div> inside of a <h1> which is not valid HTML
*/
#}

{% block content %}
{{ items[0].content }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{#
/**
* This overrides the default template which added a <div> inside of a <button> which is not valid HTML
*/
#}

{% block content %}
{{ items[0].content }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<strong>All fields are required.</strong>
</p>
<div id="error-border">
<div class="usa-form-spacing">
<div>
<label id="myStreetAddress" class="usa-label" for="input-street">
Street address
</label>
Expand All @@ -57,7 +57,7 @@
oninput="this.setCustomValidity('')"
/>
</div>
<div class="usa-form-spacing">
<div>
<label id="myCity" class="usa-label" for="input-city">City</label>
<span id="city" class="errors"></span>
<input
Expand All @@ -71,7 +71,7 @@
oninvalid="this.setCustomValidity('Fill out the city field.')"
oninput="this.setCustomValidity('')" />
</div>
<div class="usa-form-spacing">
<div>
<label id="input-state-label" class="usa-label" for="input-state">
State
</label>
Expand All @@ -85,8 +85,9 @@
<select
aria-describedby="state"
class="usa-select"
name="input-state"
name="select-dropdown"
id="input-state"
autocomplete="off"
required
oninvalid="this.setCustomValidity('Fill out the state field.')"
oninput="this.setCustomValidity('')">
Expand Down Expand Up @@ -146,7 +147,7 @@
<span id="state" class="errors"></span>
</div>
</div>
<div class="usa-form-spacing">
<div>
<label id="myZIP" class="usa-label" for="input-zip">ZIP code</label>
<span id="zip" class="errors"></span>
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@
<select
aria-describedby="state"
class="usa-select"
name="input-state"
name="select-dropdown"
id="input-state"
required
autocomplete="off"
oninvalid="this.setCustomValidity('Fill out the state field.')"
oninput="this.setCustomValidity('')">
<option id="AL" value="AL">Alabama (AL)</option>
Expand Down
56 changes: 36 additions & 20 deletions web/themes/custom/usagov/templates/footer-identifier.html.twig
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
{% if node.langcode.value %}
{% set lang = node.langcode.value %}
{% elseif language.id %}
{% set lang = language.id %}

{% if node.langcode.value == "es" %}
{% set translations = {
'official_guide': 'USAGov en Español es la guía oficial de información y servicios del Gobierno',
'official_site_1': 'Unsitio web oficial de la',
'official_site_2': 'Administración de Servicios Generales de los Estados Unidos',
'official_site_3': '(GSA, sigla en inglés)',
'accessibility_support': 'Política de accesibilidad de\n GSA (en inglés)',
'privacy_policy': 'Política de privacidad de\n GSA (en inglés)',
'foia_requests': 'Solicitud a través de\n FOIA (en inglés)'
} %}
{% else %}
{% set translations = {
'official_guide': 'USAGov is the official guide to government information and services',
'official_site_1': 'An official website of the',
'official_site_2': 'U.S. Gerneral Services Administration',
'official_site_3': '',
'accessibility_support': 'GSA accessibility support',
'privacy_policy': 'GSA privacy policy',
'foia_requests': 'FOIA requests'
} %}
{% endif %}


<div class="usa-identifier">
<section class="usa-identifier__section usa-identifier__section--usagov" {{ lang == 'es' ? "aria-label='USAGov en Español es la guía oficial de información y servicios del Gobierno'" : "aria-label='USAGov is the official guide to government information and services'" }}
aria-label="USAGov is the Official Guide to Government Information and Services">
<section class="usa-identifier__section usa-identifier__section--usagov" aria-label="{{ translations.official_guide }}">
<div class="usa-identifier__container">
<section class="usa-identifier__identity" aria-label="{{ lang == 'es' ? "Unsitio web oficial de la Administración de Servicios Generales de los Estados Unidos (GSA, sigla en inglés)" : "An official website of the U.S. Gerneral Services Administration" }}">
<p class="usa-identifier__identity-disclaimer">
{{ lang == 'es' ? "USAGov en Español es la guía oficial de información y servicios del Gobierno" : "USAGov is the official guide to government information and services" }}
</p>
<section class="usa-identifier__identity" aria-label="{{ translations.official_site_1 }} {{ translations.official_site_2 }} {{ translations.official_site_3 }}">
<p class="usa-identifier__identity-disclaimer">{{ translations.official_guide }}</p>
<p class="usa-identifier__identity-disclaimer">
{% if lang == "en" %}
<span aria-hidden="true">An</span> official website of the
<a href="https://www.gsa.gov/">U.S. General Services Administration</a>
{% else %}
<span aria-hidden="true">Un</span> sitio web oficial de la
<a href="https://www.gsa.gov/">Administraci&oacute;n de Servicios Generales de los Estados Unidos</a> (GSA, sigla en ingl&eacute;s)
{% endif %}
{{ translations.official_site_1 }} <a href="https://www.gsa.gov/">{{ translations.official_site_2 }}</a> {{ translations.official_site_3 }}
</p>
</section>
</div>
Expand All @@ -27,13 +37,19 @@
<div class="usa-identifier__container">
<ul class="usa-identifier__required-links-list">
<li class="usa-identifier__required-links-item">
<a href="https://www.gsa.gov/website-information/accessibility-statement?footer=" class="usa-identifier__required-link usa-link">{{ lang == 'es' ? "Pol&iacute;tica de accesibilidad de </br>GSA (en ingl&eacute;s)" : "GSA accessibility support" }}</a>
<a href="https://www.gsa.gov/website-information/accessibility-statement?footer=" class="usa-identifier__required-link usa-link">
{{ translations.accessibility_support|nl2br }}
</a>
</li>
<li class="usa-identifier__required-links-item">
<a href="https://www.gsa.gov/website-information/website-policies#privacy" class="usa-identifier__required-link usa-link">{{ lang == 'es' ? "Pol&iacute;tica de privacidad de </br>GSA (en ingl&eacute;s)" : "GSA privacy policy" }}</a>
<a href="https://www.gsa.gov/website-information/website-policies#privacy" class="usa-identifier__required-link usa-link">
{{ translations.privacy_policy|nl2br }}
</a>
</li>
<li class="usa-identifier__required-links-item">
<a href="https://www.gsa.gov/reference/freedom-of-information-act-foia" class="usa-identifier__required-link usa-link">{{ lang == 'es' ? "Solicitud a trav&eacute;s de </br>FOIA (en ingl&eacute;s)" : "FOIA requests" }}</a>
<a href="https://www.gsa.gov/reference/freedom-of-information-act-foia" class="usa-identifier__required-link usa-link">
{{ translations.foia_requests|nl2br }}
</a>
</li>
</ul>
</div>
Expand Down
Loading

0 comments on commit 898e826

Please sign in to comment.