Skip to content

Commit

Permalink
Merge pull request #2267 from GSA/main
Browse files Browse the repository at this point in the history
01-16-2025 Production Deploy
  • Loading branch information
ccostino authored Jan 17, 2025
2 parents 671fb6d + 9293586 commit 2e5e21e
Show file tree
Hide file tree
Showing 76 changed files with 932 additions and 1,483 deletions.
8 changes: 4 additions & 4 deletions .ds.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"filename": "app/config.py",
"hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc",
"is_verified": false,
"line_number": 123,
"line_number": 120,
"is_secret": false
}
],
Expand Down Expand Up @@ -555,15 +555,15 @@
"filename": "tests/app/main/views/test_register.py",
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
"is_verified": false,
"line_number": 201,
"line_number": 200,
"is_secret": false
},
{
"type": "Secret Keyword",
"filename": "tests/app/main/views/test_register.py",
"hashed_secret": "bb5b7caa27d005d38039e3797c3ddb9bcd22c3c8",
"is_verified": false,
"line_number": 274,
"line_number": 273,
"is_secret": false
}
],
Expand Down Expand Up @@ -684,5 +684,5 @@
}
]
},
"generated_at": "2024-11-21T23:08:45Z"
"generated_at": "2025-01-13T20:16:58Z"
}
2 changes: 1 addition & 1 deletion .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
python-version: "3.12.3"
- name: Install poetry
shell: bash
run: pip install poetry
run: pip install poetry==1.8.5
- name: Install application dependencies
shell: bash
run: make bootstrap
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ NVMSH := $(shell [ -f "$(HOME)/.nvm/nvm.sh" ] && echo "$(HOME)/.nvm/nvm.sh" || e

.PHONY: bootstrap
bootstrap: generate-version-file ## Set up everything to run the app
poetry self update
poetry self add poetry-dotenv-plugin
poetry lock --no-update
poetry install --sync --no-root
Expand Down
8 changes: 0 additions & 8 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,12 @@ def _csp(config):


def create_app(application):
application.config["FEATURE_BEST_PRACTICES_ENABLED"] = (
os.getenv("FEATURE_BEST_PRACTICES_ENABLED", "false").lower() == "true"
)

@application.context_processor
def inject_feature_flags():
feature_best_practices_enabled = application.config.get(
"FEATURE_BEST_PRACTICES_ENABLED", False
)
feature_about_page_enabled = application.config.get(
"FEATURE_ABOUT_PAGE_ENABLED", False
)
return dict(
FEATURE_BEST_PRACTICES_ENABLED=feature_best_practices_enabled,
FEATURE_ABOUT_PAGE_ENABLED=feature_about_page_enabled,
)

Expand Down
57 changes: 57 additions & 0 deletions app/assets/javascripts/sidenav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
document.addEventListener('DOMContentLoaded', () => {
const sidenavItems = document.querySelectorAll('.usa-sidenav__item > .parent-link');
let lastPath = window.location.pathname;
let debounceTimeout = null;

sidenavItems.forEach((link) => {
const parentItem = link.parentElement;
const sublist = parentItem.querySelector('.usa-sidenav__sublist');
const targetHref = link.getAttribute('href');

// initialize the menu to open the correct submenu based on the current route
if (window.location.pathname.startsWith(targetHref)) {
parentItem.classList.add('open');
link.setAttribute('aria-expanded', 'true');
}

link.addEventListener('click', (event) => {
const currentPath = window.location.pathname;

// prevent default behavior only if navigating to the same route
if (currentPath === targetHref) {
event.preventDefault();
return;
}

if (sublist && !parentItem.classList.contains('open')) {
// debounce the menu update to avoid flickering
clearTimeout(debounceTimeout);
debounceTimeout = setTimeout(() => {
parentItem.classList.add('open');
link.setAttribute('aria-expanded', 'true');
}, 50);
}
});
});

// handle browser back/forward navigation
window.addEventListener('popstate', () => {
const currentPath = window.location.pathname;

// sync menu state
sidenavItems.forEach((link) => {
const parentItem = link.parentElement;
const targetHref = link.getAttribute('href');

if (currentPath.startsWith(targetHref)) {
parentItem.classList.add('open');
link.setAttribute('aria-expanded', 'true');
} else {
parentItem.classList.remove('open');
link.setAttribute('aria-expanded', 'false');
}
});

lastPath = currentPath;
});
});
76 changes: 53 additions & 23 deletions app/assets/sass/uswds/_uswds-theme-custom-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ td.table-empty-message {
word-wrap: break-word;
}

border: 1px solid color('gray-cool-10');
padding: units(2);
// border: 1px solid color('gray-cool-10');
// padding: units(2);

.tick-cross-list-permissions {
margin: units(1) 0;
Expand Down Expand Up @@ -852,21 +852,36 @@ $do-dont-top-bar-width: 1;
}
}

.linked-content:hover {
cursor: pointer;
transform: scale(1.05);
transition: transform 0.3s ease, background-color 0.3s ease;
}
.linked-card a {
text-decoration: none;
.usa-card__header, .usa-card__media {
@include at-media('tablet') {
padding-top: units(1);
}
}
&:visited {
color: color('ink');
}
&:focus .usa-card__container {
outline: units(2px) solid color('blue-40v');
outline-offset: 0.3rem;
}
&:hover .usa-card__container, &:focus .usa-card__container {
border-color: color('blue-60v');
background: color('blue-60v');
p, h3 {
color: white;
}
svg {
filter: brightness(0) invert(1);
}
}

li.linked-card:hover > div:first-child:hover {
border-color: #005ea2;
}
&.linked-content:hover, &.linked-content:focus {
cursor: pointer;
transition: transform 0.3s ease, background-color 0.3s ease;
}

li.linked-card:hover h4,
li.linked-card:hover p,
li.linked-card:hover svg,
.best-practices_card_img:hover {
color: #005ea2;
}

.best-practices_card_img {
Expand All @@ -876,10 +891,6 @@ li.linked-card:hover svg,
margin: 0 auto;
}

.best-practices_link {
text-decoration: none;
}

.usa-link--downloadable {
position: relative;
}
Expand Down Expand Up @@ -914,17 +925,25 @@ li.linked-card:hover svg,
mask-size: 1.75ex 1.75ex;
}

nav.nav {
position: sticky;
top: units(3);
}

.usa-sidenav__sublist {
display: none;
}

.usa-sidenav__item:hover .usa-sidenav__sublist,
.usa-sidenav__item:focus-within .usa-sidenav__sublist {
.usa-sidenav__item.open .usa-sidenav__sublist {
display: block;
}

.usa-sidenav__item a {
display: block;
.usa-sidenav__sublist .bold {
font-weight: bold;
}

.usa-sidenav__sublist li[role="menuitem"] {
border-top: 1px solid #dfe1e2;
}

.icon-list {
Expand Down Expand Up @@ -957,6 +976,9 @@ li.linked-card:hover svg,
.usa-card__container {
align-items: center;
text-align: center;
border-radius: 4px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
img {
margin: units(4) auto 0;
width: units(15);
Expand All @@ -965,9 +987,17 @@ li.linked-card:hover svg,
.usa-card__body {
margin-bottom: units(2);
}
.blue-bar {
background-color: #005eb8;
height: 1.3em;
width: 100%;
margin: 0;
border-radius: 0;
}
}
}


.contact-us-card {
border: 2px solid color("ink");
padding: units(2);
Expand Down
3 changes: 0 additions & 3 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ class Config(object):
"[email protected]",
],
}
FEATURE_BEST_PRACTICES_ENABLED = (
getenv("FEATURE_BEST_PRACTICES_ENABLED", "false") == "true"
)

FEATURE_ABOUT_PAGE_ENABLED = getenv("FEATURE_ABOUT_PAGE_ENABLED", "false") == "true"

Expand Down
8 changes: 1 addition & 7 deletions app/main/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,8 @@ def __call__(self, form, field):
if field.data == "":
return

from flask import url_for
message = "Enter a public sector email address."

message = """
Enter a public sector email address or
<a class="usa-link" href="{}">find out who can use Notify</a>
""".format(
url_for("main.features")
)
if not is_gov_user(field.data.lower()):
raise ValidationError(message)

Expand Down
Loading

0 comments on commit 2e5e21e

Please sign in to comment.