forked from External/greenlight
sessions and fixes
This commit is contained in:
parent
f189c98c56
commit
434021239c
|
@ -1,9 +1,16 @@
|
||||||
class MainController < ApplicationController
|
class MainController < ApplicationController
|
||||||
|
|
||||||
|
before_action :redirect_to_room
|
||||||
|
|
||||||
# GET /
|
# GET /
|
||||||
def index
|
def index
|
||||||
|
@meeting = Meeting.new
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def redirect_to_room
|
||||||
# If the user is logged in already, move them along to their room.
|
# If the user is logged in already, move them along to their room.
|
||||||
redirect_to room_path(current_user.room.uid) if current_user
|
redirect_to room_path(current_user.room.uid) if current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,14 +1,46 @@
|
||||||
class MeetingsController < ApplicationController
|
class MeetingsController < ApplicationController
|
||||||
|
|
||||||
#before_action :verify_room_ownership
|
# GET /m/:meeting_uid
|
||||||
|
def show
|
||||||
|
@meeting = Meeting.find_by(uid: params[:meeting_uid])
|
||||||
|
if @meeting
|
||||||
|
|
||||||
# GET /r/:room_uid/meetings
|
else
|
||||||
def index
|
# Handle meeting doesn't exist.
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /m/:meeting_uid
|
||||||
|
def join
|
||||||
|
meeting = Meeting.find_by(uid: params[:meeting_uid])
|
||||||
|
if meeting
|
||||||
|
# If the user is logged in, join using their authenticated name.
|
||||||
|
if current_user
|
||||||
|
redirect_to meeting.join_path(current_user.name)
|
||||||
|
# Otherwise, use their inputed join name.
|
||||||
|
elsif params[:join_name]
|
||||||
|
redirect_to meeting.join_path(params[:join_name])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Handle meeting doesn't exist.
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /m
|
||||||
|
def create
|
||||||
|
meeting = Meeting.new(meeting_params)
|
||||||
|
if meeting.save
|
||||||
|
redirect_to meeting_path(meeting_uid: meeting.uid)
|
||||||
|
else
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
#def meeting_params(room)
|
def meeting_params
|
||||||
# params.require(:meeting).permit(:name).merge!(room: room)
|
params.require(:meeting).permit(:name)
|
||||||
#end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class RoomsController < ApplicationController
|
class RoomsController < ApplicationController
|
||||||
|
|
||||||
before_action :find_room, :verify_room_ownership
|
before_action :find_room, :verify_room_ownership
|
||||||
skip_before_action :verify_room_ownership, only: [:index, :join, :wait]
|
skip_before_action :verify_room_ownership, only: [:show, :join, :wait]
|
||||||
|
|
||||||
# GET /r/:room_uid
|
# GET /r/:room_uid
|
||||||
def index
|
def index
|
||||||
|
@ -82,6 +82,10 @@ class RoomsController < ApplicationController
|
||||||
redirect_to room_path(@room.uid)
|
redirect_to room_path(@room.uid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# GET /r/:room_uid/sessions
|
||||||
|
def sessions
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Find the room from the uid.
|
# Find the room from the uid.
|
||||||
|
|
|
@ -4,13 +4,12 @@ class Meeting < ApplicationRecord
|
||||||
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
|
|
||||||
belongs_to :room
|
belongs_to :room, optional: true
|
||||||
|
|
||||||
RETURNCODE_SUCCESS = "SUCCESS"
|
RETURNCODE_SUCCESS = "SUCCESS"
|
||||||
|
|
||||||
# Creates a meeting on the BigBlueButton server.
|
# Creates a meeting on the BigBlueButton server.
|
||||||
def start_meeting(options = {})
|
def start_meeting(options = {})
|
||||||
puts bbb
|
|
||||||
create_options = {
|
create_options = {
|
||||||
record: options[:meeting_recorded].to_s,
|
record: options[:meeting_recorded].to_s,
|
||||||
logoutURL: options[:meeting_logout_url] || '',
|
logoutURL: options[:meeting_logout_url] || '',
|
||||||
|
|
|
@ -10,12 +10,14 @@
|
||||||
<div class="center-panel-wrapper">
|
<div class="center-panel-wrapper">
|
||||||
<%= render layout: 'shared/center_panel' do %>
|
<%= render layout: 'shared/center_panel' do %>
|
||||||
<div class="center-block center-panel-content-size col-xs-12">
|
<div class="center-block center-panel-content-size col-xs-12">
|
||||||
<%= render 'shared/meeting_name_form' %>
|
<%= form_for(:meeting, url: create_meeting_path) do |f| %>
|
||||||
|
<div class="input-field col s12">
|
||||||
<div class="row">
|
<%= f.label :name, "Name" %>
|
||||||
<%= render 'main/invite_join' %>
|
<%= f.text_field :name %>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<%= f.submit "Start Meeting", class: "btn white-text light-green" %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<h4>This is an unauthenticated meeting page.</h4>
|
||||||
|
|
||||||
|
<% if current_user %>
|
||||||
|
<%= link_to "Join", join_meeting_path(uid: @meeting.uid), {method: :post} %>
|
||||||
|
<% else %>
|
||||||
|
<p>Enter a name to join the session.</p>
|
||||||
|
<%= form_tag join_meeting_path do %>
|
||||||
|
<%= text_field_tag "join_name" %>
|
||||||
|
<%= submit_tag "Join" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,10 @@
|
||||||
|
Sessions
|
||||||
|
<br><br>
|
||||||
|
<%= @meeting.recordings %>
|
||||||
|
|
||||||
|
<% @meeting.recordings.each do |rec| %>
|
||||||
|
<p><%= rec[:metadata][:meetingName] %></p>
|
||||||
|
<% Array.wrap(rec[:playback][:format]).each do |form| %>
|
||||||
|
<%= link_to form[:type], form[:url] %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -4,8 +4,7 @@
|
||||||
<p><%= @room.meeting.uid %><p>
|
<p><%= @room.meeting.uid %><p>
|
||||||
<p><%= @room.uid %><p>
|
<p><%= @room.uid %><p>
|
||||||
|
|
||||||
<%= link_to 'Sessions', root_path %>
|
<%= link_to 'Sessions', sessions_path %>
|
||||||
<%= link_to 'Recordings', root_path %>
|
|
||||||
<%= link_to 'Settings', root_path %>
|
<%= link_to 'Settings', root_path %>
|
||||||
|
|
||||||
<p>Click below to join the meeting.</p>
|
<p>Click below to join the meeting.</p>
|
|
@ -1,20 +1,27 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
# Room and Meeting routes.
|
# Room routes.
|
||||||
scope '/r/:room_uid' do
|
scope '/r/:room_uid' do
|
||||||
get '/', to: 'rooms#index', as: :room
|
get '/', to: 'rooms#show', as: :room
|
||||||
match '/start', to: 'rooms#start', as: :start_room, via: [:get, :post]
|
match '/start', to: 'rooms#start', as: :start_room, via: [:get, :post]
|
||||||
match '/join', to: 'rooms#join', as: :join_room, via: [:get, :post]
|
match '/join', to: 'rooms#join', as: :join_room, via: [:get, :post]
|
||||||
match '/wait', to: 'rooms#wait', as: :wait_room, via: [:get, :post]
|
match '/wait', to: 'rooms#wait', as: :wait_room, via: [:get, :post]
|
||||||
match '/logout', to: 'rooms#logout', as: :logout_room, via: [:get, :post]
|
match '/logout', to: 'rooms#logout', as: :logout_room, via: [:get, :post]
|
||||||
resources :meetings, only: [:index], param: :meeting_uid
|
get '/sessions', to: 'rooms#sessions', as: :sessions
|
||||||
|
end
|
||||||
|
|
||||||
|
# Meeting routes.
|
||||||
|
scope '/m' do
|
||||||
|
post '/', to: 'meetings#create', as: :create_meeting
|
||||||
|
get '/:meeting_uid', to: 'meetings#show', as: :meeting
|
||||||
|
post '/:meeting_uid', to: 'meetings#join', as: :join_meeting
|
||||||
end
|
end
|
||||||
|
|
||||||
# Signup routes.
|
# Signup routes.
|
||||||
get '/signup', to: 'users#new'
|
get '/signup', to: 'users#new'
|
||||||
post '/signup', to: 'users#create'
|
post '/signup', to: 'users#create'
|
||||||
|
|
||||||
# Handles login of :greenlight provider account.
|
# Handles login of greenlight provider accounts.
|
||||||
post '/login', to: 'sessions#create', as: :create_session
|
post '/login', to: 'sessions#create', as: :create_session
|
||||||
|
|
||||||
# Login to Greenlight.
|
# Login to Greenlight.
|
||||||
|
|
Loading…
Reference in New Issue