From fefe3c2232a42a6b8cfadf37ca8819797a2254e4 Mon Sep 17 00:00:00 2001 From: Teal <git@teal.is> Date: Mon, 27 May 2024 17:20:13 +0200 Subject: [PATCH] jump to current time --- app/views/conferences/show.html.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/conferences/show.html.erb b/app/views/conferences/show.html.erb index e453ec5..f5c4bf3 100644 --- a/app/views/conferences/show.html.erb +++ b/app/views/conferences/show.html.erb @@ -9,6 +9,9 @@ current_time = Time.zone.now.in_time_zone(@conference.time_zone) %> <%= turbo_stream_from @conference %> <div> + <div> + <a href="#now" onclick="document.querySelector('#now').scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' }); return false" class="underline text-blue-500">Jump to current time</a> + </div> <h1 class="text-2xl font-bold my-2"><%= @conference.name %></h1> <p class="text-xs mb-6"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline-block size-4 stroke-slate-500"> @@ -88,8 +91,10 @@ current_time = Time.zone.now.in_time_zone(@conference.time_zone) currentTimeDiv.style.top = `${topPosition}px`; currentTimeDiv.style.display = 'block'; + currentTimeDiv.id = 'now'; } else { currentTimeDiv.style.display = 'none'; + currentTimeDiv.removeAttribute('id'); } } -- GitLab