diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3b41e50c..b255cdfa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -180,9 +180,10 @@ module ApplicationHelper # TODO:Snap!Con: Replace this with a search for a conference logo. def nav_root_link_for(conference) + path = conference.present? ? conference_path(conference) : root_path link_to( image_tag('snapcon_logo.png'), - root_path, + path, class: 'navbar-brand', title: nav_link_text(conference) ) @@ -208,4 +209,15 @@ module ApplicationHelper object.picture.large.url end end + + # Embed links with a localized timezone URL + # Timestamps are stored at UTC but in the real timezone. + # We must convert then shift the time back to get the correct value. + def inyourtz(time, timezone = 'GMT', &block) + time = time.in_time_zone(timezone) + time -= time.utc_offset + link_to "https://inyourtime.zone/t?#{time.to_i}", target: '_blank' do + block.call + end + end end diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index a5fd187f..bfd6851a 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -76,7 +76,9 @@ %dl#proposal-info .col-md-12 %dt Date: - %dd= @event_schedule.start_time.strftime("%Y %B %e - %H:%M") if @event_schedule + %dd + = inyourtz(@event_schedule.start_time, @conference.timezone) do + = @event_schedule.start_time.strftime("%Y %B %e - %H:%M") if @event_schedule .col-md-12 %dt Duration: %dd= show_time(@event.event_type.length) @@ -121,7 +123,9 @@ %dl %dt Start Time: %dd - = event.program.selected_event_schedules.find { |es| es.event == event }.start_time.strftime("%Y %B %e %H:%M") + - event_schedule = event.program.selected_event_schedules.find { |es| es.event == event } + = inyourtz(event_schedule.start_time, @conference.timezone) do + = event_schedule.start_time.strftime("%Y %B %e %H:%M") %br %dt Room: %dd diff --git a/app/views/schedules/_event.html.haml b/app/views/schedules/_event.html.haml index 63a65233..2dbe5087 100644 --- a/app/views/schedules/_event.html.haml +++ b/app/views/schedules/_event.html.haml @@ -24,12 +24,13 @@ -# TODO: More informative text or aria-label. = link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400 - if event_schedule.present? - %span.track - %span.fa.fa-clock-o - %span.label{ style: "background-color: grey" } - = event_schedule.start_time.strftime('%H:%M') - \- - = event_schedule.end_time.strftime('%H:%M') + = inyourtz(event_schedule.start_time, @conference.timezone) do + %span.track + %span.fa.fa-clock-o + %span.label{ style: "background-color: grey" } + = event_schedule.start_time.strftime('%H:%M') + \- + = event_schedule.end_time.strftime('%H:%M') %span.track %span.fa.fa-map-marker %span.label{ style: "background-color: grey" } diff --git a/app/views/schedules/events.html.haml b/app/views/schedules/events.html.haml index 8680d3c3..934fae84 100644 --- a/app/views/schedules/events.html.haml +++ b/app/views/schedules/events.html.haml @@ -27,13 +27,15 @@ .col-xs-12.col-md-12 .date-content %span{ class: 'date-title', id: "#{ event_schedule.start_time.strftime('%Y-%m-%d') }" } - = date = event_schedule.start_time.strftime('%Y-%m-%d') + = inyourtz(event_schedule.start_time, @conference.timezone) do + = date = event_schedule.start_time.strftime('%Y-%m-%d') %a{ title: "Go up", class: "pull-right", href: "#program" } %i{ class: "fa fa-angle-double-up fa-lg", 'aria-hidden' => true } - unless event_schedule.start_time.strftime('%H:%M').eql?(time) .col-xs-12.col-md-1 .start-time - = time = event_schedule.start_time.strftime('%H:%M') + = inyourtz(event_schedule.start_time, @conference.timezone) do + = time = event_schedule.start_time.strftime('%H:%M') .col-xs-12.col-md-11 .new-time-event = render partial: 'event', locals: { event: event_schedule.event, event_schedule: event_schedule }