From ab67ecc973130d82b18b91a7302698675ac8c75d Mon Sep 17 00:00:00 2001 From: Ximena Kilroe Date: Mon, 30 Sep 2024 14:23:22 -0400 Subject: [PATCH 01/12] Update the templates with missing info intro and make sure showing/hiding info sessions is working --- .eleventy.js | 1 + _data/assetPaths.json | 2 +- .../layouts/jointts/job-listing-info-sessions.html | 8 +++++++- _includes/scripts.html | 12 ++++++++++++ pages/jointts/positions/login-gov-data-analyist.md | 5 ++--- .../positions/organizational_culture_specialist.md | 2 +- pages/jointts/positions/position-template.md | 2 +- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 5949c88c..9f2eb5a7 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -159,6 +159,7 @@ module.exports = function (config) { // Datetime format: YYYY-MM-DD HH:MM config.addLiquidShortcode("getDateTimeinSeconds", getDateTimeinSeconds); function getDateTimeinSeconds(datetime) { + console.log(datetime); // Split the datetime string into date and time parts const dateParts = datetime.split(" "); const date = dateParts[0]; diff --git a/_data/assetPaths.json b/_data/assetPaths.json index bc6d8cd1..e35e2aab 100644 --- a/_data/assetPaths.json +++ b/_data/assetPaths.json @@ -6,4 +6,4 @@ "uswds.js": "/assets/js/uswds-init.js", "styles.css": "/assets/styles/styles-6UNDCLW2.css", "styles.map": "/assets/styles/styles-6UNDCLW2.css.map" -} +} \ No newline at end of file diff --git a/_includes/layouts/jointts/job-listing-info-sessions.html b/_includes/layouts/jointts/job-listing-info-sessions.html index 342bd1bf..27c90ae0 100644 --- a/_includes/layouts/jointts/job-listing-info-sessions.html +++ b/_includes/layouts/jointts/job-listing-info-sessions.html @@ -15,7 +15,11 @@ {% assign session_end_str = session_date | append: " " | append: session_end_time %} + {{ session_end_str }} + {% capture sessionEndTimestamp %}{% getDateTimeinSeconds session_end_str %}{% endcapture %} + + {{ sessionEndTimestamp }} {% if sessionEndTimestamp > now %} @@ -42,12 +46,14 @@ {% assign session_end_str = session_date | append: " " | append: session_end_time %} + {{ session_end_str }} + {% capture sessionEndTimestamp %}{% getDateTimeinSeconds session_end_str %}{% endcapture %} {% if sessionEndTimestamp > now %}
  • -

    {{ session.headline }} at {{ session.time }}

    +

    {{ session.date | date: "%A, %B %d, %Y" }} at {{ session.time }}

  • {% endif %} {% endfor %} diff --git a/_includes/scripts.html b/_includes/scripts.html index ae9b8e2d..cd3c55d9 100644 --- a/_includes/scripts.html +++ b/_includes/scripts.html @@ -53,12 +53,24 @@ const currentTimestamp = new Date(now).getTime(); const infoSessions = document.querySelectorAll(".info-sessions-list li"); + let visibleSessions = 0; + infoSessions.forEach(session => { const session_timestamp = parseInt(session.getAttribute('data-session-end-timestamp'), 10); if (session_timestamp < currentTimestamp) { session.style.display = 'none'; + } else { + visibleSessions++; } }); + + // If no visible sessions, hide the