Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/job template refinements #387

Merged
merged 25 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f8081b1
Update instructions
ximekilgsa Sep 25, 2024
bf2c2e7
Merge branch 'main' into fix/job-template-refinements
ximekilgsa Sep 25, 2024
290272f
Additional templating and adjust the logic for showing info sessions …
ximekilgsa Sep 25, 2024
aa3b29c
Add shortcode to convert string to timestamp
ximekilgsa Sep 25, 2024
fd99b47
Output some variables for testing
ximekilgsa Sep 25, 2024
bc9cc20
Add now to the output vars
ximekilgsa Sep 25, 2024
514c69f
Adjust for timezone and more testing
ximekilgsa Sep 25, 2024
15472b9
Change where we're logging, we only want the two
ximekilgsa Sep 25, 2024
4677ea6
Output session date
ximekilgsa Sep 25, 2024
b364159
One last check
ximekilgsa Sep 25, 2024
9e5ff98
Remove logging and revert date
ximekilgsa Sep 25, 2024
35c989b
Lets readd debugging
ximekilgsa Sep 25, 2024
ab24b3f
Add time logic to info sessions
ximekilgsa Sep 25, 2024
c45d1b9
Merge branch 'main' into fix/job-template-refinements
ximekilgsa Sep 25, 2024
548236b
Add client side JS
ximekilgsa Sep 26, 2024
cbafe7e
Remove footer image that isn't displaying and throwing an error
ximekilgsa Sep 26, 2024
8a988b4
Move code to scripts.html
ximekilgsa Sep 26, 2024
01cd694
[MegaLinter] Apply linters fixes
wesley-dean-gsa Sep 26, 2024
82f0796
Merge branch 'main' into fix/job-template-refinements
ximekilgsa Sep 26, 2024
b2fba27
Merge pull request #401 from GSA-TTS/staging
ximekilgsa Sep 27, 2024
3c1d20c
Merge branch 'main' into fix/job-template-refinements
ximekilgsa Sep 30, 2024
c3e69c8
Localize hidePastInfoSessions
ximekilgsa Sep 30, 2024
6ff92b0
[MegaLinter] Apply linters fixes
wesley-dean-gsa Sep 30, 2024
8e8a942
Merge branch 'staging' into fix/job-template-refinements
ximekilgsa Sep 30, 2024
df29007
Template updates
ximekilgsa Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,38 @@ module.exports = function (config) {
});
}

config.addLiquidShortcode("getStateFromDates", getStateFromDates);
// Get Date and Time as Seconds
// Datetime format: YYYY-MM-DD HH:
config.addLiquidShortcode("getDateTimeinSeconds", getDateTimeinSeconds);
function getDateTimeinSeconds(datetime) {
ximekilgsa marked this conversation as resolved.
Show resolved Hide resolved
// Split the datetime string into date and time parts
const dateParts = datetime.split(" ");
const date = dateParts[0];
const time = dateParts[1];

// Extract hours, minutes, and AM/PM
let hours = parseInt(time.slice(0, time.length - 2).split(":")[0], 10); // Adjusted to capture full hour
const minutes = time.length === 6 ? time.slice(2, 4) : time.slice(3, 5);
const amPm = time.slice(-2).toLowerCase(); // Handle AM/PM case

// Convert hours to 24-hour format
if (amPm === "pm" && hours !== 12) {
hours += 12;
} else if (amPm === "am" && hours === 12) {
hours = 0;
}

// Format the datetime string for timestamp conversion
const formattedDatetime = `${date} ${String(hours).padStart(2, "0")}:${minutes} EST`;

// Convert to timestamp (in seconds)
const timestamp = Math.floor(new Date(formattedDatetime).getTime() / 1000);

return timestamp;
}

// Get State From Dates
config.addLiquidShortcode("getStateFromDates", getStateFromDates);
function getStateFromDates(opens, closes) {
if (!opens && !closes) {
return "unknown";
Expand Down Expand Up @@ -187,14 +217,16 @@ module.exports = function (config) {
config.addFilter("sortByProp", sortByProp);

config.addFilter("readableDate", (dateObj) => {
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat(
return DateTime.fromJSDate(dateObj, { zone: "America/New_York" }).toFormat(
"dd LLL yyyy",
);
});

// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
config.addFilter("htmlDateString", (dateObj) => {
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat("yyyy-LL-dd");
return DateTime.fromJSDate(dateObj, { zone: "America/New_York" }).toFormat(
"yyyy-LL-dd",
);
});

// Get the first `n` elements of a collection.
Expand Down
1 change: 0 additions & 1 deletion _data/assetPaths.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"admin.map": "/assets/js/admin-77FHK54G.js.map",
"app.js": "/assets/js/app-U5OIPSUD.js",
"app.map": "/assets/js/app-U5OIPSUD.js.map",
"uswds.js": "/assets/js/uswds-init.js",
"styles.css": "/assets/styles/styles-6UNDCLW2.css",
"styles.map": "/assets/styles/styles-6UNDCLW2.css.map"
}
3 changes: 0 additions & 3 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
mobile-lg:grid-col-6 mobile-lg:grid-gap-2
"
>
<div class="mobile-lg:grid-col-auto">
<img class="usa-footer__logo-img" src="/assets/img/logo-img.png" alt="" />
</div>
<div class="mobile-lg:grid-col-auto">
<p class="usa-footer__logo-heading">Technology Transformation Services</p>
<p style="font-size: .875rem;"><strong>Built with:</strong> <a href="https://designsystem.digital.gov/whats-new/updates/2022/04/28/introducing-uswds-3-0/">USWDS 3</a> | <a href="https://cloud.gov/pages/">Cloud.gov Pages</a> | <a href="https://digital.gov/guides/dap/">Digital Analytics Program</a></p>
Expand Down
153 changes: 11 additions & 142 deletions _includes/layouts/jointts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,133 +27,20 @@ <h1>{{ title }}</h1>
</div>
<div class="grid-row grid-gap">
<div class="desktop:grid-col-8 usa-prose">
<!-- Open Jobs -->
<h2 id="open-positions">Open positions</h2>
<p>We are hiring and will be sharing upcoming jobs and open positions as they are available.</p>
{% include "layouts/jointts/open-jobs.html" %}
ximekilgsa marked this conversation as resolved.
Show resolved Hide resolved

<ul>
{% assign open_job_count = 0 %}
{% for pg in collections.jobs %}
{% capture state %}{% getStateFromDates pg.data.opens pg.data.closes %}{% endcapture %}
{% if state == "open" %}
{% unless pg.data.path contains 'template' %}
{% unless pg.data.path contains 'performance-profiles' %}
{% assign open_job_count = open_job_count | plus: 1 %}
<li>
{% if pg.data.external_url %}
<a href="{{ pg.data.external_url }}" target="_blank">{{ pg.data.title }}</a>
{% else %}
<a href="{{ pg.url | url }}">{{ pg.data.title }}</a>
{% endif %}
(Open now {% if pg.data.weeks_open %}for {% if pg.data.weeks < 52 %}{{ pg.data.weeks }}{% else %} one year or until all selections have been made{% endif %},{% endif %} through {{ pg.data.closes | date: '%A, %B %e, %Y at 11:59pm' }} ET)
<!-- Info Sessions -->
{% assign now = 'now' | date: "%s" %}
{% assign future_sessions = false %}

{% for session in pg.data.info_sessions %}
{% assign session_date = session.date | date: "%s" %}
{% if session_date > now %}
{% assign future_sessions = true %}
{% break %}
{% endif %}
{% endfor %}
{% if future_sessions %}
<aside class="usa-alert usa-alert-info">
<div class="usa-alert-body">
<p>Upcoming info sessions for {{ pg.data.title }}</p>
<ul>
{% for session in pg.data.info_sessions %}
{% assign session_date = session.date | date: "%s" %}
{% if session_date > now %}
<li>
<p><a href="{{ session.link }}" target="_blank">{{ session.headline }}</a> at {{ session.time }}</p>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</aside>
{% endif %}
</li>
{% endunless %}
{% endunless %}
{% endif %}
{% endfor %}
</ul>

{% if open_job_count == 0 %}
<p>No open positions at this time. Sign up for <a href="/join/newsletter/">job alerts!</a></p>
{% endif %}

<!-- Upcoming Jobs -->
<h2>Upcoming positions</h2>
<ul>
{% assign upcoming_job_count = 0 %}

{% for pg in collections.jobs %}
{% capture state %}{% getStateFromDates pg.data.opens pg.data.closes %}{% endcapture %}

{% assign show_job = false %}

{% if pg.data.title != "" %}
{% if state == "upcoming" %}
{% assign show_job = true %}
{% elsif state == "unknown" %}
{% assign show_job = true %}
{% endif %}
{% endif %}

{% if show_job %}
{% assign upcoming_job_count = upcoming_job_count | plus: 1 %}
{% unless pg.data.path contains 'template' %}
{% unless pg.data.path contains 'performance-profiles' %}
<li>
{% if pg.data.external_url %}
<a href="{{ pg.data.external_url }}">{{ pg.data.title }}</a>
{% else %}
<a href="{{ pg.url | url }}">{{ pg.data.title }}</a>
{% endif %}

<!-- Info Sessions -->
{% assign now = 'now' | date: "%s" %}
{% assign future_sessions = false %}

{% for session in pg.data.info_sessions %}
{% assign session_date = session.date | date: "%s" %}
{% if session_date > now %}
{% assign future_sessions = true %}
{% break %}
{% endif %}
{% endfor %}
{% if future_sessions %}
<aside class="usa-alert usa-alert-info">
<div class="usa-alert-body">
<p>Upcoming info sessions for {{ pg.data.title }}</p>
<ul>
{% for session in pg.data.info_sessions %}
{% assign session_date = session.date | date: "%s" %}
{% if session_date > now %}
<li>
<p><a href="{{ session.link }}" target="_blank">{{ session.headline }}</a> at {{ session.time }}</p>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</aside>
{% endif %}
</li>
{% endunless %}
{% endunless %}
{% endif %}
{% endfor %}
</ul>

{% if upcoming_job_count == 0 %}
<p>No upcoming positions at this time. Sign up for <a href="/join/newsletter/">job alerts!</a></p>
{% endif %}
{% include "layouts/jointts/upcoming-jobs.html" %}

<!-- Other Opportunities -->
<h2>Other GSA Opportunities</h2>
<p>Check out <a href="https://www.gsa.gov/about-us/find-apply-for-and-land-a-job-at-gsa">careers at GSA</a> and more <a href="https://www.usajobs.gov/Search/Results?j=2210&d=GS&p=1">Information Technology opportunities.</a></p>

<!-- Application Process -->
<h2>Application process</h2>
<p>
We have an amazing recruitment team who will usher you from application to interview to onboarding with TTS.
Expand All @@ -164,29 +51,11 @@ <h2>Application process</h2>
our Talent Team at <a href="mailto:joinTTS@gsa.gov">joinTTS@gsa.gov</a>.
</p>
</div>
<div class="desktop:grid-col-4 margin-top-4 desktop:margin-top-0">
<div class="usa-summary-box">
<div class="usa-summary-box__body">
<h3 class="usa-summary-box__heading">Find out more</h3>
<div class="usa-summary-box__text">
<p>Join us at one of our monthly online information sessions. Come learn more about working at TTS, available positions, and our application process. Register for a session below.</p>
<ul>
{% for session in sorted_info_sessions %}
{% assign session_date = session.date | date: "%s" %}
{% assign now = 'now' | date: "%s" %}
{% if session_date > now %}
<li class="info-session">
<a target="_blank" href="{{ session.link }}" rel="noopener">{{ session.date | date: "%A, %B %d, %Y" }}</a>
<p>{{ session.time-et }}</p>
<p>({{ session.time-pt }})</p>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</div>
</div>

<!-- General Info Sessions -->
{% if sorted_info_sessions.size > 0 %}
{% include "layouts/jointts/info-sessions-sidebar.html" %}
{% endif %}
</div>
</div>
</section>
37 changes: 37 additions & 0 deletions _includes/layouts/jointts/info-sessions-sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<div class="desktop:grid-col-4 margin-top-4 desktop:margin-top-0">
<div class="usa-summary-box">
<div class="usa-summary-box__body">
<h3 class="usa-summary-box__heading">Find out more</h3>
<div class="usa-summary-box__text">
<p>Join us at one of our monthly online information sessions. Come learn more about working at TTS, available positions, and our application process. Register for a session below.</p>
<ul class="info-sessions-list">
{% for session in sorted_info_sessions %}
<!-- Format the date for comparison -->
{% assign session_date = session.date | date: "%Y-%m-%d" %}

<!-- Extract ET time range from session.time (e.g., "1:00-2:00pm ET") -->
{% assign time_et = session.time-et | split: " ET" %}

<!-- Extract start time and end time (e.g., "1:00pm" and "2:00pm") -->
{% assign session_end_time = time_et | split: "-" | last | strip %}

<!-- Combine the date with the start and end times -->
{% assign session_end_str = session_date | append: " " | append: session_end_time %}

{% capture sessionEndTimestamp %}{% getDateTimeinSeconds session_end_str %}{% endcapture %}

{% assign now = 'now' | date: "%s" %}

{% if sessionEndTimestamp > now %}
<li class="info-session" data-session-end-timestamp="{{ sessionEndTimestamp }}">
<a target="_blank" href="{{ session.link }}" rel="noopener">{{ session.date | date: "%A, %B %d, %Y" }}</a>
<p>{{ session.time-et }}</p>
<p>({{ session.time-pt }})</p>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
57 changes: 57 additions & 0 deletions _includes/layouts/jointts/job-listing-info-sessions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!-- Info Sessions -->
{% assign now = 'now' | date: "%s" %}
{% assign future_sessions = false %}

{% for session in pg.data.info_sessions %}
<!-- Format the date for comparison -->
{% assign session_date = session.date | date: "%Y-%m-%d" %}

<!-- Extract ET time range from session.time (e.g., "1:00-2:00pm ET") -->
{% assign time_et = session.time | split: " ET" | first %}

<!-- Extract start time and end time (e.g., "1:00pm" and "2:00pm") -->
{% assign session_end_time = time_et | split: "-" | last | strip %}

<!-- Combine the date with the start and end times -->
{% assign session_end_str = session_date | append: " " | append: session_end_time %}

{% capture sessionEndTimestamp %}{% getDateTimeinSeconds session_end_str %}{% endcapture %}

<!-- Check if session is still upcoming or ongoing -->
{% if sessionEndTimestamp > now %}
{% assign future_sessions = true %}
{% break %}
{% endif %}
{% endfor %}

{% if future_sessions %}
<aside class="usa-alert usa-alert-info">
<div class="usa-alert-body">
<p>Upcoming or ongoing info sessions for {{ pg.data.title }}</p>
<ul class="info-sessions-list">
{% for session in pg.data.info_sessions %}
<!-- Format the date for comparison -->
{% assign session_date = session.date | date: "%Y-%m-%d" %}

<!-- Extract ET time range from session.time (e.g., "1:00-2:00pm ET") -->
{% assign time_et = session.time | split: " ET" | first %}

<!-- Extract start time and end time (e.g., "1:00pm" and "2:00pm") -->
{% assign session_end_time = time_et | split: "-" | last | strip %}

<!-- Combine the date with the start and end times -->
{% assign session_end_str = session_date | append: " " | append: session_end_time %}

{% capture sessionEndTimestamp %}{% getDateTimeinSeconds session_end_str %}{% endcapture %}

<!-- Show if session is still ongoing or upcoming -->
{% if sessionEndTimestamp > now %}
<li data-session-end-timestamp="{{ sessionEndTimestamp }}">
<p><a href="{{ session.link }}" target="_blank">{{ session.headline }}</a> at {{ session.time }}</p>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</aside>
{% endif %}
29 changes: 29 additions & 0 deletions _includes/layouts/jointts/open-jobs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<ul>
{% assign open_job_count = 0 %}
{% for pg in collections.jobs %}
{% capture state %}{% getStateFromDates pg.data.opens pg.data.closes %}{% endcapture %}
{% if state == "open" %}
{% unless pg.data.path contains 'template' %}
{% unless pg.data.path contains 'performance-profiles' %}
{% assign open_job_count = open_job_count | plus: 1 %}
<li>
{% if pg.data.external_url %}
<a href="{{ pg.data.external_url }}" target="_blank">{{ pg.data.title }}</a>
{% else %}
<a href="{{ pg.url | url }}">{{ pg.data.title }}</a>
{% endif %}
(Open now {% if pg.data.weeks_open %}for {% if pg.data.weeks < 52 %}{{ pg.data.weeks }}{% else %} one year or until all selections have been made{% endif %},{% endif %} through {{ pg.data.closes | date: '%A, %B %e, %Y at 11:59pm' }} ET)

<!-- Info Sessions -->
{% include "layouts/jointts/job-listing-info-sessions.html" %}

</li>
{% endunless %}
{% endunless %}
{% endif %}
{% endfor %}
</ul>

{% if open_job_count == 0 %}
<p>No open positions at this time. Sign up for <a href="/join/newsletter/">job alerts!</a></p>
{% endif %}
Loading
Loading