Google Calendaer Link
This commit is contained in:
parent
2417bad4db
commit
29cea21c84
3 changed files with 30 additions and 3 deletions
|
|
@ -191,6 +191,29 @@ module EventsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def calendar_timestamp(timestamp, timezone)
|
||||||
|
timestamp = timestamp.in_time_zone('GMT')
|
||||||
|
timestamp -= timestamp.utc_offset
|
||||||
|
timestamp.strftime('%Y%m%dT%H%M%S')
|
||||||
|
end
|
||||||
|
|
||||||
|
def google_calendar_link(event_schedule)
|
||||||
|
event = event_schedule.event
|
||||||
|
conference = event.conference
|
||||||
|
calendar_base = 'https://www.google.com/calendar/render'
|
||||||
|
start_timestamp = calendar_timestamp(event_schedule.start_time, conference.timezone)
|
||||||
|
end_timestamp = calendar_timestamp(event_schedule.end_time, conference.timezone)
|
||||||
|
event_details = {
|
||||||
|
action: 'TEMPLATE',
|
||||||
|
text: "#{event.title} at #{conference.title}",
|
||||||
|
details: "#{conference.title}:\n\n#{event.room&.url}\n\n#{truncate(event.abstract, length: 200)}",
|
||||||
|
location: "#{event.room.name} #{event.room&.url}",
|
||||||
|
dates: "#{start_timestamp}/#{end_timestamp}",
|
||||||
|
ctz: event_schedule.timezone
|
||||||
|
}
|
||||||
|
"#{calendar_base}?#{event_details.to_param}"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def active_dropdown(selection, options)
|
def active_dropdown(selection, options)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
.container
|
.container
|
||||||
.row.page-header
|
.row.page-header
|
||||||
.col-md-10
|
.col-md-8
|
||||||
%h2
|
%h2
|
||||||
= @event.title
|
= @event.title
|
||||||
- if @event.subtitle
|
- if @event.subtitle
|
||||||
|
|
@ -22,8 +22,12 @@
|
||||||
= @event.subtitle
|
= @event.subtitle
|
||||||
%h3
|
%h3
|
||||||
= join_event_link(@event, current_user)
|
= join_event_link(@event, current_user)
|
||||||
.col-md-2
|
.col-md-4
|
||||||
%p{style: "margin-top: 20px"}
|
%p{style: "margin-top: 20px"}
|
||||||
|
- if @event_schedule.start_time
|
||||||
|
= link_to google_calendar_link(@event_schedule), target: '_blank', class: 'btn btn-success' do
|
||||||
|
%i.fa.fa-calendar
|
||||||
|
Google Calendar
|
||||||
- if can?(:update, @event) && @event.require_registration?
|
- if can?(:update, @event) && @event.require_registration?
|
||||||
= link_to 'Registrations', registrations_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-success'
|
= link_to 'Registrations', registrations_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-success'
|
||||||
- if can?(:edit, @event)
|
- if can?(:edit, @event)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
-# TODO: More informative text or aria-label.
|
-# TODO: More informative text or aria-label.
|
||||||
= link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400
|
= link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400
|
||||||
- if event_schedule.present?
|
- if event_schedule.present?
|
||||||
= inyourtz(event_schedule.start_time, @conference.timezone) do
|
= inyourtz(event_schedule.start_time) do
|
||||||
%span.track
|
%span.track
|
||||||
%span.fa.fa-clock-o
|
%span.fa.fa-clock-o
|
||||||
%span.label{ style: "background-color: grey" }
|
%span.label{ style: "background-color: grey" }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue