Skip to content

Commit

Permalink
Open chat buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Jul 18, 2023
1 parent b480c7c commit 6b12d64
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 21 deletions.
16 changes: 4 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,17 @@ capybara-*.html
**.orig
rerun.txt
pickle-email-*.html
*~
/public/assets
/bundle
/doc/app
.vagrant/
.env
.env.production
.env.development
.env.test
.env.local
.envrc
.env*
docker-compose.override.yml
.DS_Store

.byebug_history
.buildconfig
osem_development
osem_test
config/local_env.yml

# From GitHub, for Ruby
# https://github.com/github/gitignore/blob/master/Ruby.gitignore
Expand All @@ -77,10 +70,9 @@ config/local_env.yml
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env
# ensure the folder exists for puma
!tmp/pids/.keep

# Ignore Byebug command history file.
.byebug_history
Expand Down
33 changes: 24 additions & 9 deletions app/helpers/events_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,28 +213,43 @@ def convert_timezone(date, old_timezone, new_timezone)
end

def join_event_link(event, event_schedule, current_user, small: false)
return unless current_user && event_schedule && event_schedule.room_url.present?
return unless current_user && event_schedule
return if event.ended?

unless event_schedule.room_url.present?
return content_tag :span, class: 'label label-default' do
'In-person only'
end
end

conference = event.conference
is_now = event_schedule.happening_now? # 30 minute threshold.
is_registered = conference.user_registered?(current_user)
admin = current_user.roles.where(id: conference.roles).any?
admin = current_user.roles.where(id: conference.roles).any? || current_user.is_admin
# is_presenter = event.speakers.include?(current_user) || event.volunteers.include?(current_user)

if admin || (is_now && is_registered)
link_to("Join Event Now #{'(Early)' unless is_now}",
join_conference_program_proposal_path(conference, event),
target: '_blank', class: "btn btn-primary #{'btn-xs' if small}",
'aria-label': "Join #{event.title}", rel: 'noopener')
join_btn = link_to("Join Event Now #{'(Early)' unless is_now}",
join_conference_program_proposal_path(conference, event),
target: '_blank', class: "btn btn-primary #{'btn-xs' if small}",
'aria-label': "Join #{event.title}", rel: 'noopener')
if event_schedule.room.discussion_url.present?
discussion_link = link_to('Open Chat',
event_schedule.room.discussion_url,
target: '_blank', class: "btn btn-info #{'btn-xs' if small}",
'aria-label': "Join #{event.title}", rel: 'noopener')
content_tag(:div, join_btn + discussion_link, class: 'btn-group')
else
join_btn
end
elsif is_registered
content_tag :span, class: 'btn btn-default btn-xs disabled' do
'Click to Join During Event'
content_tag :span, class: 'label label-primary' do
'Click to Join Online During Event'
end
else
link_to('Register for the conference to join this event.',
conference_conference_registration_path(conference),
class: 'btn btn-default btn-xs',
class: 'btn btn-info btn-xs',
'aria-label': "Register for #{event.title}")
end
end
Expand Down
16 changes: 16 additions & 0 deletions app/views/rooms/live_session.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@
%iframe{ src: @room.embed_url, with: '67%', style: 'flex-grow: 1' }
- if @room.discussion_url.present?
%iframe{ src: @room.discussion_url, width: '33%' }

- if @room.discussion_url.present?
#discourse-comments
%meta{name: 'discourse-username', content: 'DISCOURSE_USERNAME'}
:javascript
DiscourseEmbed = {
discourseUrl: 'https://forum.snap.berkeley.edu/',
discourseEmbedUrl: "#{@room.discussion_url}",
// className: 'CLASS_NAME',
};

(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
})();
Empty file added tmp/pids/.keep
Empty file.

0 comments on commit 6b12d64

Please sign in to comment.