From f9f0d2972fb1487802697fda4a3ea15b4f57b8f6 Mon Sep 17 00:00:00 2001 From: MitchLloyd Date: Tue, 19 Nov 2024 11:01:05 +0000 Subject: [PATCH 1/2] set start time on time stamper component --- common-theme/assets/scripts/time-stamper.js | 3 ++- common-theme/hugo.toml | 1 + common-theme/layouts/_default/day-plan.html | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common-theme/assets/scripts/time-stamper.js b/common-theme/assets/scripts/time-stamper.js index 49126792f..fb8766610 100644 --- a/common-theme/assets/scripts/time-stamper.js +++ b/common-theme/assets/scripts/time-stamper.js @@ -10,6 +10,7 @@ class TimeStamper extends HTMLElement { `; this.timelineEntries = this.querySelectorAll(".c-block"); + this.startTime = this.getAttribute('start-time'); } connectedCallback() { @@ -17,7 +18,7 @@ class TimeStamper extends HTMLElement { } stampTime() { - let currentTime = new Date("1970-01-01T10:00:00"); // Set initial time to 10:00 AM + let currentTime = new Date(`1970-01-01T${this.startTime}`); // Set initial time to 10:00 AM this.timelineEntries.forEach((entry) => { const timeElement = entry.querySelector(".c-block__time"); diff --git a/common-theme/hugo.toml b/common-theme/hugo.toml index c1a85cf7b..3be4f2cb7 100644 --- a/common-theme/hugo.toml +++ b/common-theme/hugo.toml @@ -28,6 +28,7 @@ defaultContentLanguageInSubdir = false [params] googleFonts="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;500;700&family=Inter:wght@400;600&display=swap" description = "A free and open source software development programme." +startTime="10:00" # main_website = "" # main_org_name = "eg Code Your Future" # our_name = "alias for in text replacement" diff --git a/common-theme/layouts/_default/day-plan.html b/common-theme/layouts/_default/day-plan.html index 451a7e8e6..7bca0ddd1 100644 --- a/common-theme/layouts/_default/day-plan.html +++ b/common-theme/layouts/_default/day-plan.html @@ -12,8 +12,7 @@ {{ errorf "There are no blocks on the %s page. Make sure this day plan has blocks." $.Page.RelPermalink }} {{ end }} - - +
{{ if ne .Params.noRegister true }} {{ partial "register-attendance.html" (dict "course" site.Title "module" $.Page.CurrentSection.Parent.Title "day" $.Page.CurrentSection.Title) }} From 084fe69fc46077e14392594fec45f7d198c5682b Mon Sep 17 00:00:00 2001 From: MitchLloyd Date: Tue, 19 Nov 2024 11:12:57 +0000 Subject: [PATCH 2/2] update arguments passed to time-stamper --- common-theme/layouts/_default/day-plan.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common-theme/layouts/_default/day-plan.html b/common-theme/layouts/_default/day-plan.html index 7bca0ddd1..307a8a50d 100644 --- a/common-theme/layouts/_default/day-plan.html +++ b/common-theme/layouts/_default/day-plan.html @@ -11,8 +11,8 @@ {{ if not .Params.blocks }} {{ errorf "There are no blocks on the %s page. Make sure this day plan has blocks." $.Page.RelPermalink }} {{ end }} - - + {{ $startTime := .Params.startTime | default "10:00" }} +
{{ if ne .Params.noRegister true }} {{ partial "register-attendance.html" (dict "course" site.Title "module" $.Page.CurrentSection.Parent.Title "day" $.Page.CurrentSection.Title) }}