tidy up event#show page, google calendar link

This commit is contained in:
Michael Ball 2020-12-09 02:46:16 -08:00
parent acfc3e7aff
commit ab3c8ff4ca
2 changed files with 24 additions and 12 deletions

View file

@ -164,7 +164,7 @@ module EventsHelper
conference_id, conference_id,
event.id, event.id,
event.send(attribute), event.send(attribute),
url: admin_conference_program_event_path( url: admin_conference_program_event_path(
conference_id, conference_id,
event, event,
event: { attribute => nil } event: { attribute => nil }
@ -208,7 +208,7 @@ module EventsHelper
event_details = { event_details = {
action: 'TEMPLATE', action: 'TEMPLATE',
text: "#{event.title} at #{conference.title}", text: "#{event.title} at #{conference.title}",
details: "#{conference.title}:\n\n#{event.room&.url}\n\n#{truncate(event.abstract, length: 200)}", details: calendar_event_text(event, event_schedule, conference),
location: "#{event.room.name} #{event.room&.url}", location: "#{event.room.name} #{event.room&.url}",
dates: "#{start_timestamp}/#{end_timestamp}", dates: "#{start_timestamp}/#{end_timestamp}",
ctz: event_schedule.timezone ctz: event_schedule.timezone
@ -218,6 +218,18 @@ module EventsHelper
private private
def calendar_event_text(event, event_schedue, conference)
<<~TEXT
#{conference.title} - #{event.title}
#{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone}
More Info: #{event.url}
Join: #{event.room&.url}
#{truncate(event.abstract, length: 200)}"
TEXT
end
def active_dropdown(selection, options) def active_dropdown(selection, options)
# Consistent rendering of dropdown lists that submit patched changes # Consistent rendering of dropdown lists that submit patched changes
# #

View file

@ -25,9 +25,9 @@
.col-md-4 .col-md-4
%p{style: "margin-top: 20px"} %p{style: "margin-top: 20px"}
- if @event_schedule&.start_time - if @event_schedule&.start_time
= link_to google_calendar_link(@event_schedule), target: '_blank', class: 'btn btn-success' do = link_to google_calendar_link(@event_schedule), target: '_blank', class: 'btn btn-success btn-mini' do
%i.fa.fa-calendar %i.fa.fa-calendar
Google Calendar Add to Google Calendar (beta)
- 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)
@ -96,16 +96,16 @@
.col-md-12 .col-md-12
%dt Language: %dt Language:
%dd= @event.language %dd= @event.language
.col-md-12 - if @event.track
%dt Track: .col-md-12
%dd %dt Track:
- if @event.track %dd
%span.label{style: "background-color: #{@event.track.color}; color: #{ contrast_color(@event.track.color) }"} %span.label{style: "background-color: #{@event.track.color}; color: #{ contrast_color(@event.track.color) }"}
= @event.track.name = @event.track.name
.col-md-12 - if @event.difficulty_level
%dt Difficulty: .col-md-12
%dd %dt Difficulty:
- if @event.difficulty_level %dd
%span.label{style: "background-color: #{@event.difficulty_level.color}; color: #{ contrast_color(@event.difficulty_level.color) };"} %span.label{style: "background-color: #{@event.difficulty_level.color}; color: #{ contrast_color(@event.difficulty_level.color) };"}
= @event.difficulty_level.title = @event.difficulty_level.title