From 64a044f8387252b7d78b7cfb392076aa23617c5f Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sat, 23 Aug 2025 21:52:44 +0800 Subject: [PATCH 01/16] Add next class day plan guidance to the intro page --- org-cyf-itp/content/_index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org-cyf-itp/content/_index.md b/org-cyf-itp/content/_index.md index 5c6e10ce6..af5233605 100644 --- a/org-cyf-itp/content/_index.md +++ b/org-cyf-itp/content/_index.md @@ -4,3 +4,5 @@ menus_to_map=["start here", "course schedule", "next steps"] description="New? Lost? [Quickstart](how-this-works/prep/#overview)" emoji= "🧑🏿‍🏫" +++ + +Here’s how you find out what to do when: {{< next-class-day-plan >}} From c630af1b88049727c172fd08d9f6aedf7f589612 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sat, 23 Aug 2025 21:53:13 +0800 Subject: [PATCH 02/16] Add next class day plan functionality to the layout --- .../layouts/partials/next-class-day-plan.html | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 org-cyf-theme/layouts/partials/next-class-day-plan.html diff --git a/org-cyf-theme/layouts/partials/next-class-day-plan.html b/org-cyf-theme/layouts/partials/next-class-day-plan.html new file mode 100644 index 000000000..5fcfcd01c --- /dev/null +++ b/org-cyf-theme/layouts/partials/next-class-day-plan.html @@ -0,0 +1,30 @@ +{{/* Compute link to next class day plan */}} +{{ $weekdays := dict "Sunday" 0 "Monday" 1 "Tuesday" 2 "Wednesday" 3 "Thursday" 4 "Friday" 5 "Saturday" 6 }} +{{ $now := now }} +{{ $todayIdx := index $weekdays (time.Format "Monday" $now) }} +{{ $daysUntilSat := mod (add (sub 6 $todayIdx) 7) 7 }} +{{ $nextClass := $now | time.AddDate 0 0 $daysUntilSat }} + +{{ $year := int (time.Format "2006" $nextClass) }} +{{ $month := int (time.Format "1" $nextClass) }} +{{ $quarterMonth := add (mul (div (sub $month 1) 3) 3) 1 }} +{{ $start := time (printf "%04d-%02d-01" $year $quarterMonth) }} +{{ $startIdx := index $weekdays (time.Format "Monday" $start) }} +{{ $daysToSat := mod (add (sub 6 $startIdx) 7) 7 }} +{{ $courseStart := $start | time.AddDate 0 0 $daysToSat }} + +{{ $startUnix := $courseStart.Unix }} +{{ $classUnix := $nextClass.Unix }} +{{ $daysFromStart := div (sub $classUnix $startUnix) 86400 }} +{{ $sprint := add 1 (div $daysFromStart 7) }} + +{{ $dayPlans := site.Menus.scheduled }} +{{ $match := first 1 (where $dayPlans "Identifier" (printf "%d" $sprint)) }} +{{ if not (len $match) }} + {{ $match = first 1 (where $dayPlans "Weight" $sprint) }} +{{ end }} +{{ with index $match 0 }} + Day plan for sprint {{ $sprint }} +{{ else }} + Day plan coming soon +{{ end }} From 96ba406c35f83170e9f77e86cbc7f89fec4f333e Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sat, 23 Aug 2025 21:53:26 +0800 Subject: [PATCH 03/16] Add shortcode wrapper for next class day plan partial --- org-cyf-theme/layouts/shortcodes/next-class-day-plan.html | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 org-cyf-theme/layouts/shortcodes/next-class-day-plan.html diff --git a/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html b/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html new file mode 100644 index 000000000..24e1fc28e --- /dev/null +++ b/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html @@ -0,0 +1,2 @@ +{{/* Shortcode wrapper for next-class-day-plan partial */}} +{{ partial "next-class-day-plan.html" . }} From d33d67ad29a03bfa430a328d97a291a130feeb69 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sat, 23 Aug 2025 23:10:44 +0800 Subject: [PATCH 04/16] Refactor next class day plan logic for improved readability --- org-cyf-theme/layouts/partials/next-class-day-plan.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org-cyf-theme/layouts/partials/next-class-day-plan.html b/org-cyf-theme/layouts/partials/next-class-day-plan.html index 5fcfcd01c..0a8bd70e1 100644 --- a/org-cyf-theme/layouts/partials/next-class-day-plan.html +++ b/org-cyf-theme/layouts/partials/next-class-day-plan.html @@ -3,7 +3,7 @@ {{ $now := now }} {{ $todayIdx := index $weekdays (time.Format "Monday" $now) }} {{ $daysUntilSat := mod (add (sub 6 $todayIdx) 7) 7 }} -{{ $nextClass := $now | time.AddDate 0 0 $daysUntilSat }} +{{ $nextClass := time.AddDate $now 0 0 $daysUntilSat }} {{ $year := int (time.Format "2006" $nextClass) }} {{ $month := int (time.Format "1" $nextClass) }} @@ -11,7 +11,7 @@ {{ $start := time (printf "%04d-%02d-01" $year $quarterMonth) }} {{ $startIdx := index $weekdays (time.Format "Monday" $start) }} {{ $daysToSat := mod (add (sub 6 $startIdx) 7) 7 }} -{{ $courseStart := $start | time.AddDate 0 0 $daysToSat }} +{{ $courseStart := time.AddDate $start 0 0 $daysToSat }} {{ $startUnix := $courseStart.Unix }} {{ $classUnix := $nextClass.Unix }} @@ -27,4 +27,4 @@ Day plan for sprint {{ $sprint }} {{ else }} Day plan coming soon -{{ end }} +{{ end }} \ No newline at end of file From 6b571c706f3fc13fc53213de2067f9d1f530edcf Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sat, 23 Aug 2025 23:35:53 +0800 Subject: [PATCH 05/16] Refactor next class day plan logic for improved clarity and consistency --- .../layouts/partials/next-class-day-plan.html | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/org-cyf-theme/layouts/partials/next-class-day-plan.html b/org-cyf-theme/layouts/partials/next-class-day-plan.html index 0a8bd70e1..5d7a56d27 100644 --- a/org-cyf-theme/layouts/partials/next-class-day-plan.html +++ b/org-cyf-theme/layouts/partials/next-class-day-plan.html @@ -1,24 +1,37 @@ {{/* Compute link to next class day plan */}} {{ $weekdays := dict "Sunday" 0 "Monday" 1 "Tuesday" 2 "Wednesday" 3 "Thursday" 4 "Friday" 5 "Saturday" 6 }} + +{{/* Resolve base time: prefer .Page.Date (shortcode context), else .Date, else now */}} {{ $now := now }} -{{ $todayIdx := index $weekdays (time.Format "Monday" $now) }} -{{ $daysUntilSat := mod (add (sub 6 $todayIdx) 7) 7 }} -{{ $nextClass := time.AddDate $now 0 0 $daysUntilSat }} +{{ with .Page }} + {{ with .Date }} + {{ $now = . }} + {{ end }} +{{ else }} + {{ with .Date }} + {{ $now = . }} + {{ end }} +{{ end }} + +{{ $todayIdx := index $weekdays ($now.Format "Monday") }} +{{ $daysUntilSat := mod (add (sub 6 $todayIdx) 7) 7 | int }} +{{ $nextClass := $now.AddDate 0 0 $daysUntilSat }} -{{ $year := int (time.Format "2006" $nextClass) }} -{{ $month := int (time.Format "1" $nextClass) }} +{{ $year := int ($nextClass.Format "2006") }} +{{ $month := int ($nextClass.Format "1") }} {{ $quarterMonth := add (mul (div (sub $month 1) 3) 3) 1 }} {{ $start := time (printf "%04d-%02d-01" $year $quarterMonth) }} -{{ $startIdx := index $weekdays (time.Format "Monday" $start) }} -{{ $daysToSat := mod (add (sub 6 $startIdx) 7) 7 }} -{{ $courseStart := time.AddDate $start 0 0 $daysToSat }} +{{ $startIdx := index $weekdays ($start.Format "Monday") }} +{{ $daysToSat := mod (add (sub 6 $startIdx) 7) 7 | int }} +{{ $courseStart := $start.AddDate 0 0 $daysToSat }} {{ $startUnix := $courseStart.Unix }} {{ $classUnix := $nextClass.Unix }} {{ $daysFromStart := div (sub $classUnix $startUnix) 86400 }} {{ $sprint := add 1 (div $daysFromStart 7) }} -{{ $dayPlans := site.Menus.scheduled }} +{{/* Use an empty slice as default if the scheduled menu doesn't exist */}} +{{ $dayPlans := default (slice) site.Menus.scheduled }} {{ $match := first 1 (where $dayPlans "Identifier" (printf "%d" $sprint)) }} {{ if not (len $match) }} {{ $match = first 1 (where $dayPlans "Weight" $sprint) }} From 18a5e363e23c48da62d3921f3dd16338a0a003a8 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sun, 24 Aug 2025 13:23:35 +0800 Subject: [PATCH 06/16] Modify _index.md --- org-cyf-itp/content/_index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/org-cyf-itp/content/_index.md b/org-cyf-itp/content/_index.md index af5233605..64fd13222 100644 --- a/org-cyf-itp/content/_index.md +++ b/org-cyf-itp/content/_index.md @@ -1,8 +1,8 @@ -+++ -title="Intro to Programming" -menus_to_map=["start here", "course schedule", "next steps"] -description="New? Lost? [Quickstart](how-this-works/prep/#overview)" -emoji= "🧑🏿‍🏫" -+++ - -Here’s how you find out what to do when: {{< next-class-day-plan >}} ++++ +title="Intro to Programming" +menus_to_map=["start here", "course schedule", "next steps"] +description="New? Lost? [Quickstart](how-this-works/prep/#overview)" +emoji= "🧑🏿‍🏫" ++++ + +Here’s how you find out what to do when: {{< next-class-day-plan >}} From 748f6f62f961e5f6d45e168fe11a0da2bee9ba88 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sun, 24 Aug 2025 13:24:04 +0800 Subject: [PATCH 07/16] Modify shortcode --- org-cyf-theme/layouts/shortcodes/next-class-day-plan.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html b/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html index 24e1fc28e..023e951f5 100644 --- a/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html +++ b/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html @@ -1,2 +1,2 @@ -{{/* Shortcode wrapper for next-class-day-plan partial */}} -{{ partial "next-class-day-plan.html" . }} +{{/* Shortcode wrapper for next-class-day-plan partial */}} +{{ partial "next-class-day-plan.html" . }} From e7e462eea74795665bf45963427abde341086ebc Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sun, 24 Aug 2025 13:39:18 +0800 Subject: [PATCH 08/16] Add package.json for project configuration and scripts --- org-cyf-theme/package.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 org-cyf-theme/package.json diff --git a/org-cyf-theme/package.json b/org-cyf-theme/package.json new file mode 100644 index 000000000..8dfda53cd --- /dev/null +++ b/org-cyf-theme/package.json @@ -0,0 +1,13 @@ +{ + "name": "org-cyf-theme", + "version": "1.0.0", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "fix-instructions": "echo 'Fix: pass .Date to the partial or change the partial to use .Date when available. Example partial snippet: {{ $base := time.Now }} {{ with .Date }}{{ $base = . }}{{ end }} {{ $next := $base.AddDate 0 0 7 }} Next class: {{ $next.Format \"Jan 2, 2006\" }}'" + }, + "devDependencies": { + "prettier": "^2.8.8", + "prettier-plugin-go-template": "^0.0.13" + } +} \ No newline at end of file From 385809357fd8669385aedb45ee5d713eea25d623 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sun, 24 Aug 2025 13:39:36 +0800 Subject: [PATCH 09/16] Add package-lock.json for dependency management --- org-cyf-theme/package-lock.json | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 org-cyf-theme/package-lock.json diff --git a/org-cyf-theme/package-lock.json b/org-cyf-theme/package-lock.json new file mode 100644 index 000000000..3ff497bba --- /dev/null +++ b/org-cyf-theme/package-lock.json @@ -0,0 +1,58 @@ +{ + "name": "org-cyf-theme", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "org-cyf-theme", + "version": "1.0.0", + "devDependencies": { + "prettier": "^2.8.8", + "prettier-plugin-go-template": "^0.0.13" + } + }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-go-template": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/prettier-plugin-go-template/-/prettier-plugin-go-template-0.0.13.tgz", + "integrity": "sha512-gG/xT5kd+kCzoMaTchXvdfBdsunyRCV6G8cgdPGPd2V5JGGKXUG7SjzBKU7jaGh2RTeblcAdBb/E+S/duOAMsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ulid": "^2.3.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "prettier": "^2.0.0" + } + }, + "node_modules/ulid": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.4.0.tgz", + "integrity": "sha512-fIRiVTJNcSRmXKPZtGzFQv9WRrZ3M9eoptl/teFJvjOzmpU+/K/JH6HZ8deBfb5vMEpicJcLn7JmvdknlMq7Zg==", + "dev": true, + "license": "MIT", + "bin": { + "ulid": "bin/cli.js" + } + } + } +} \ No newline at end of file From 21d58980c0135029e607e8c0f6b9afe16b7cc584 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sun, 24 Aug 2025 13:42:17 +0800 Subject: [PATCH 10/16] Add package-lock.json --- org-cyf-theme/package-lock.json | 114 ++++++++++++++++---------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/org-cyf-theme/package-lock.json b/org-cyf-theme/package-lock.json index 3ff497bba..f5bd26923 100644 --- a/org-cyf-theme/package-lock.json +++ b/org-cyf-theme/package-lock.json @@ -1,58 +1,58 @@ -{ - "name": "org-cyf-theme", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "org-cyf-theme", - "version": "1.0.0", - "devDependencies": { - "prettier": "^2.8.8", - "prettier-plugin-go-template": "^0.0.13" - } - }, - "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-plugin-go-template": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/prettier-plugin-go-template/-/prettier-plugin-go-template-0.0.13.tgz", - "integrity": "sha512-gG/xT5kd+kCzoMaTchXvdfBdsunyRCV6G8cgdPGPd2V5JGGKXUG7SjzBKU7jaGh2RTeblcAdBb/E+S/duOAMsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ulid": "^2.3.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "prettier": "^2.0.0" - } - }, - "node_modules/ulid": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.4.0.tgz", - "integrity": "sha512-fIRiVTJNcSRmXKPZtGzFQv9WRrZ3M9eoptl/teFJvjOzmpU+/K/JH6HZ8deBfb5vMEpicJcLn7JmvdknlMq7Zg==", - "dev": true, - "license": "MIT", - "bin": { - "ulid": "bin/cli.js" - } - } - } +{ + "name": "org-cyf-theme", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "org-cyf-theme", + "version": "1.0.0", + "devDependencies": { + "prettier": "^2.8.8", + "prettier-plugin-go-template": "^0.0.13" + } + }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-go-template": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/prettier-plugin-go-template/-/prettier-plugin-go-template-0.0.13.tgz", + "integrity": "sha512-gG/xT5kd+kCzoMaTchXvdfBdsunyRCV6G8cgdPGPd2V5JGGKXUG7SjzBKU7jaGh2RTeblcAdBb/E+S/duOAMsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ulid": "^2.3.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "prettier": "^2.0.0" + } + }, + "node_modules/ulid": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.4.0.tgz", + "integrity": "sha512-fIRiVTJNcSRmXKPZtGzFQv9WRrZ3M9eoptl/teFJvjOzmpU+/K/JH6HZ8deBfb5vMEpicJcLn7JmvdknlMq7Zg==", + "dev": true, + "license": "MIT", + "bin": { + "ulid": "bin/cli.js" + } + } + } } \ No newline at end of file From 40a3653a8241df6ff14a33c46955f5bf3dba703a Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Sun, 24 Aug 2025 13:42:40 +0800 Subject: [PATCH 11/16] package.json --- org-cyf-theme/package.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/org-cyf-theme/package.json b/org-cyf-theme/package.json index 8dfda53cd..650e5e8f5 100644 --- a/org-cyf-theme/package.json +++ b/org-cyf-theme/package.json @@ -1,13 +1,13 @@ -{ - "name": "org-cyf-theme", - "version": "1.0.0", - "private": true, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "fix-instructions": "echo 'Fix: pass .Date to the partial or change the partial to use .Date when available. Example partial snippet: {{ $base := time.Now }} {{ with .Date }}{{ $base = . }}{{ end }} {{ $next := $base.AddDate 0 0 7 }} Next class: {{ $next.Format \"Jan 2, 2006\" }}'" - }, - "devDependencies": { - "prettier": "^2.8.8", - "prettier-plugin-go-template": "^0.0.13" - } +{ + "name": "org-cyf-theme", + "version": "1.0.0", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "fix-instructions": "echo 'Fix: pass .Date to the partial or change the partial to use .Date when available. Example partial snippet: {{ $base := time.Now }} {{ with .Date }}{{ $base = . }}{{ end }} {{ $next := $base.AddDate 0 0 7 }} Next class: {{ $next.Format \"Jan 2, 2006\" }}'" + }, + "devDependencies": { + "prettier": "^2.8.8", + "prettier-plugin-go-template": "^0.0.13" + } } \ No newline at end of file From b350d3a3b744c342ca2f9a8fc0ca940ccdaedd8c Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Mon, 1 Sep 2025 19:46:14 +0800 Subject: [PATCH 12/16] Add shortcode for computing next class day plan --- .../shortcodes/next-class-day-plan.html | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 common-theme/layouts/shortcodes/next-class-day-plan.html diff --git a/common-theme/layouts/shortcodes/next-class-day-plan.html b/common-theme/layouts/shortcodes/next-class-day-plan.html new file mode 100644 index 000000000..6cb55f46a --- /dev/null +++ b/common-theme/layouts/shortcodes/next-class-day-plan.html @@ -0,0 +1,41 @@ +{{/* Compute link to next class day plan */}} +{{ $weekdays := dict "Sunday" 0 "Monday" 1 "Tuesday" 2 "Wednesday" 3 "Thursday" 4 "Friday" 5 "Saturday" 6 }} + +{{/* Resolve base time: prefer .Page.Date (shortcode context), else .Date, else now */}} +{{ $now := now }} +{{ with .Page }} + {{ with .Date }} + {{ $now = . }} + {{ end }} +{{ else }} + {{ with .Date }} + {{ $now = . }} + {{ end }} +{{ end }} + +{{ $todayIdx := index $weekdays ($now.Format "Monday") }} +{{ $daysUntilSat := mod (add (sub 6 $todayIdx) 7) 7 | int }} +{{ $nextClass := $now.AddDate 0 0 $daysUntilSat }} + +{{ $year := int ($nextClass.Format "2006") }} +{{ $month := int ($nextClass.Format "1") }} +{{ $quarterMonth := add (mul (div (sub $month 1) 3) 3) 1 }} +{{ $start := time (printf "%04d-%02d-01" $year $quarterMonth) }} +{{ $startIdx := index $weekdays ($start.Format "Monday") }} +{{ $daysToSat := mod (add (sub 6 $startIdx) 7) 7 | int }} +{{ $courseStart := $start.AddDate 0 0 $daysToSat }} + +{{ $startUnix := $courseStart.Unix }} +{{ $classUnix := $nextClass.Unix }} +{{ $daysFromStart := div (sub $classUnix $startUnix) 86400 }} +{{ $sprint := add 1 (div $daysFromStart 7) }} + +{{/* Gather day plan pages within the current module */}} +{{ $module := .Page.CurrentSection }} +{{ $dayPlans := sort (where $module.Pages "Params.menu_level" "intersect" (slice "module")) "Weight" }} + +{{ with index $dayPlans (sub $sprint 1) }} + Day plan for sprint {{ $sprint }} +{{ else }} + Day plan coming soon +{{ end }} From 275cf39c9101d8195a8cdfd2a4b3598efe6c2359 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Mon, 1 Sep 2025 20:47:49 +0800 Subject: [PATCH 13/16] Update README.md for clarity and structure --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 618fc9577..ec23bfa78 100644 --- a/README.md +++ b/README.md @@ -91,3 +91,15 @@ For each module you import, add a `replace` directive to your `go.mod` file - if ## To locally develop your site Check [org-cyf/README.md](/org-cyf/README.md) on how to set up your local environment. Once that is done you can `cd` into the site you wish to develop, and run `npm run start:dev` to get a live preview. + +## Shortcodes + +### `next-class-day-plan` + +The `next-class-day-plan` shortcode pulls sprint pages from the existing `syllabus`/`module` menu hierarchy, so no additional `scheduled` menu is required. + +Example: + +``` +{{< next-class-day-plan >}} +``` From bd71dbdfcbd7caab75c988bc10bc942ceac328f9 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Mon, 1 Sep 2025 21:39:58 +0800 Subject: [PATCH 14/16] Update README.md for next-class-day-plan clarity and adjust file permissions for various scripts --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec23bfa78..29a917149 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ Check [org-cyf/README.md](/org-cyf/README.md) on how to set up your local enviro ### `next-class-day-plan` -The `next-class-day-plan` shortcode pulls sprint pages from the existing `syllabus`/`module` menu hierarchy, so no additional `scheduled` menu is required. +The `next-class-day-plan` shortcode pulls sprint pages from the existing `syllabus`/`module` menu hierarchy. Example: From 14211a043572916b0cb431bd0c029d02c9637c05 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Mon, 1 Sep 2025 21:42:12 +0800 Subject: [PATCH 15/16] Remove html file from partials --- .../layouts/partials/next-class-day-plan.html | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 org-cyf-theme/layouts/partials/next-class-day-plan.html diff --git a/org-cyf-theme/layouts/partials/next-class-day-plan.html b/org-cyf-theme/layouts/partials/next-class-day-plan.html deleted file mode 100644 index 5d7a56d27..000000000 --- a/org-cyf-theme/layouts/partials/next-class-day-plan.html +++ /dev/null @@ -1,43 +0,0 @@ -{{/* Compute link to next class day plan */}} -{{ $weekdays := dict "Sunday" 0 "Monday" 1 "Tuesday" 2 "Wednesday" 3 "Thursday" 4 "Friday" 5 "Saturday" 6 }} - -{{/* Resolve base time: prefer .Page.Date (shortcode context), else .Date, else now */}} -{{ $now := now }} -{{ with .Page }} - {{ with .Date }} - {{ $now = . }} - {{ end }} -{{ else }} - {{ with .Date }} - {{ $now = . }} - {{ end }} -{{ end }} - -{{ $todayIdx := index $weekdays ($now.Format "Monday") }} -{{ $daysUntilSat := mod (add (sub 6 $todayIdx) 7) 7 | int }} -{{ $nextClass := $now.AddDate 0 0 $daysUntilSat }} - -{{ $year := int ($nextClass.Format "2006") }} -{{ $month := int ($nextClass.Format "1") }} -{{ $quarterMonth := add (mul (div (sub $month 1) 3) 3) 1 }} -{{ $start := time (printf "%04d-%02d-01" $year $quarterMonth) }} -{{ $startIdx := index $weekdays ($start.Format "Monday") }} -{{ $daysToSat := mod (add (sub 6 $startIdx) 7) 7 | int }} -{{ $courseStart := $start.AddDate 0 0 $daysToSat }} - -{{ $startUnix := $courseStart.Unix }} -{{ $classUnix := $nextClass.Unix }} -{{ $daysFromStart := div (sub $classUnix $startUnix) 86400 }} -{{ $sprint := add 1 (div $daysFromStart 7) }} - -{{/* Use an empty slice as default if the scheduled menu doesn't exist */}} -{{ $dayPlans := default (slice) site.Menus.scheduled }} -{{ $match := first 1 (where $dayPlans "Identifier" (printf "%d" $sprint)) }} -{{ if not (len $match) }} - {{ $match = first 1 (where $dayPlans "Weight" $sprint) }} -{{ end }} -{{ with index $match 0 }} - Day plan for sprint {{ $sprint }} -{{ else }} - Day plan coming soon -{{ end }} \ No newline at end of file From ed67d4f7bda4f2ed7ef1afdadf4d759d4fcc3741 Mon Sep 17 00:00:00 2001 From: JohnnyRobs19 Date: Mon, 1 Sep 2025 21:42:39 +0800 Subject: [PATCH 16/16] Remove html file from shortcodes --- org-cyf-theme/layouts/shortcodes/next-class-day-plan.html | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 org-cyf-theme/layouts/shortcodes/next-class-day-plan.html diff --git a/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html b/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html deleted file mode 100644 index 023e951f5..000000000 --- a/org-cyf-theme/layouts/shortcodes/next-class-day-plan.html +++ /dev/null @@ -1,2 +0,0 @@ -{{/* Shortcode wrapper for next-class-day-plan partial */}} -{{ partial "next-class-day-plan.html" . }}