From 6ca2459034fceae235698cbd1360827c6ab94d44 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Tue, 19 Aug 2025 16:57:26 -0700 Subject: [PATCH] server: highlight today's date on the calendar widget --- server/src/email_extract.rs | 7 +++++-- server/templates/ical_summary.html | 22 +++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/server/src/email_extract.rs b/server/src/email_extract.rs index b53292b..65d23bc 100644 --- a/server/src/email_extract.rs +++ b/server/src/email_extract.rs @@ -285,6 +285,7 @@ pub fn extract_calendar_metadata_from_mail( event_days: event_days.clone(), caption, description_paragraphs: &description_paragraphs, + today: Some(chrono::Local::now().date_naive()), }; if let Ok(rendered) = template.render() { body_html = Some(rendered); @@ -1444,10 +1445,11 @@ pub struct IcalSummaryTemplate<'a> { pub local_fmt_end: &'a str, pub organizer: &'a str, pub organizer_cn: &'a str, - pub all_days: Vec, - pub event_days: Vec, + pub all_days: Vec, + pub event_days: Vec, pub caption: String, pub description_paragraphs: &'a [String], + pub today: Option, } // Add this helper function to parse the DMARC XML and summarize it. @@ -1800,6 +1802,7 @@ pub fn render_ical_summary(ical_data: &str) -> Result { event_days: event_days.clone(), caption, description_paragraphs: description_paragraphs_val, + today: Some(chrono::Local::now().date_naive()), }; summary_parts.push(template.render()?); } diff --git a/server/templates/ical_summary.html b/server/templates/ical_summary.html index a5134bc..3c5287d 100644 --- a/server/templates/ical_summary.html +++ b/server/templates/ical_summary.html @@ -69,13 +69,25 @@ {% for week in all_days|batch(7) %} {% for day in week %} - {% if event_days.contains(day) %} + {% if event_days.contains(day) && today.is_some() && today.unwrap() == day %} + + {{ day.day() }} + + {% elif event_days.contains(day) %} - {{ day.day() }} + {{ day.day() }} + + {% elif today.is_some() && today.unwrap() == day %} + + {{ day.day() }} + {% else %} - {{ - day.day() }} + + {{ day.day() }} + {% endif %} {% endfor %} @@ -93,4 +105,4 @@

{{ p }}

{% endfor %} -{% endif %} +{% endif %} \ No newline at end of file