From e4a51ca393a06df353253505ec94b7c8f7ef0ecd Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 17 Aug 2026 18:58:09 -0400 Subject: [PATCH] automatically scroll to today --- app/views/common/_calendar.html.erb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb index f42c350..8229a3a 100644 --- a/app/views/common/_calendar.html.erb +++ b/app/views/common/_calendar.html.erb @@ -97,6 +97,8 @@ <% week.each do |day| %> <% + is_today = (day == User.current.today) + # Filter out standard events if "only appointments" toggle is active standard_events = only_appointments ? [] : calendar.events_on(day).reject { |e| e.is_a?(CustomerAppointment) } @@ -130,12 +132,14 @@ end %> -
  • +
  • >

    - <%= day.day %> + style="text-decoration: none; color: inherit;"> + <%= day.day %> + (<%= abbr_day_name(day.cwday) %>) @@ -247,6 +251,15 @@ if (!urlParams.has('only_appointments') && savedState === '1') { urlParams.set('only_appointments', '1'); window.location.search = urlParams.toString(); + return; + } + + // Automatically scroll to today if present and no specific hash anchor is in the URL + if (!window.location.hash) { + const todayElement = document.getElementById('today'); + if (todayElement) { + todayElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } } });