Better design for room URLs

This commit is contained in:
Michael Ball 2020-07-17 10:03:07 -07:00
parent ae6581826d
commit 31dfd62fbd
4 changed files with 25 additions and 6 deletions

View file

@ -173,6 +173,24 @@ module EventsHelper
)
end
def join_event_link(event, current_user)
return unless event.url.present? && current_user
conference = event.conference
is_today = event.time&.today?
if current_user.roles.where(id: conference.roles).any?
# Show Pre-Event links for any memeber of the conference team.
link_to("Join Live Event #{'(Pre-Event)' unless is_today}",
event.url, target: '_blank')
elsif current_user.registered_to_event?(conference)
if is_today
link_to('Join Live Event', event.url, target: '_blank')
else
link_to('Live Event Link Coming Soon', '#')
end
end
end
private
def active_dropdown(selection, options)

View file

@ -31,6 +31,8 @@ class Event < ApplicationRecord
belongs_to :track
belongs_to :difficulty_level
belongs_to :program
belongs_to :room
delegate :url, to: :room, allow_nil: true
accepts_nested_attributes_for :event_users, allow_destroy: true
accepts_nested_attributes_for :speakers, allow_destroy: true

View file

@ -16,9 +16,8 @@
%br
%small
= @event.subtitle
- if @event.room&.url && @conference.user_registered?(current_user)
%h3
= link_to('Join Event', @event.room.url, target: '_blank')
%h3
= join_event_link(@event, current_user)
.col-md-2
%p{style: "margin-top: 20px"}
- if can?(:update, @event) && @event.require_registration?

View file

@ -17,11 +17,11 @@
%h4
- if(event.speakers.any?)
presented by #{event.speaker_names}
- if event.room&.url && @conference.user_registered?(current_user)
%p
= link_to('Join Event', event.room.url, target: '_blank')
%h5
= join_event_link(event, current_user)
%p
= markdown(truncate(event.abstract, length: 400))
-# 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