sessions and fixes

This commit is contained in:
Josh
2018-05-22 16:58:11 -04:00
parent f189c98c56
commit 434021239c
10 changed files with 98 additions and 27 deletions

View File

@ -1,9 +1,16 @@
class MainController < ApplicationController
before_action :redirect_to_room
# GET /
def index
@meeting = Meeting.new
end
private
def redirect_to_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
end
end

View File

@ -1,14 +1,46 @@
class MeetingsController < ApplicationController
#before_action :verify_room_ownership
# GET /m/:meeting_uid
def show
@meeting = Meeting.find_by(uid: params[:meeting_uid])
if @meeting
else
# Handle meeting doesn't exist.
end
end
# GET /r/:room_uid/meetings
def index
# 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
private
#def meeting_params(room)
# params.require(:meeting).permit(:name).merge!(room: room)
#end
def meeting_params
params.require(:meeting).permit(:name)
end
end

View File

@ -1,7 +1,7 @@
class RoomsController < ApplicationController
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
def index
@ -82,6 +82,10 @@ class RoomsController < ApplicationController
redirect_to room_path(@room.uid)
end
# GET /r/:room_uid/sessions
def sessions
end
private
# Find the room from the uid.
@ -111,4 +115,4 @@ class RoomsController < ApplicationController
redirect_to root_path
end
end
end
end

View File

@ -4,13 +4,12 @@ class Meeting < ApplicationRecord
validates :name, presence: true
belongs_to :room
belongs_to :room, optional: true
RETURNCODE_SUCCESS = "SUCCESS"
# Creates a meeting on the BigBlueButton server.
def start_meeting(options = {})
puts bbb
create_options = {
record: options[:meeting_recorded].to_s,
logoutURL: options[:meeting_logout_url] || '',
@ -154,4 +153,4 @@ class Meeting < ApplicationRecord
o = ([('a'..'z'), ('A'..'Z')].map do |i| i.to_a end).flatten
((0...length).map do o[rand(o.length)] end).join
end
end
end

View File

@ -10,12 +10,14 @@
<div class="center-panel-wrapper">
<%= render layout: 'shared/center_panel' do %>
<div class="center-block center-panel-content-size col-xs-12">
<%= render 'shared/meeting_name_form' %>
<div class="row">
<%= render 'main/invite_join' %>
</div>
<%= form_for(:meeting, url: create_meeting_path) do |f| %>
<div class="input-field col s12">
<%= f.label :name, "Name" %>
<%= f.text_field :name %>
</div>
<br>
<%= f.submit "Start Meeting", class: "btn white-text light-green" %>
<% end %>
</div>
<% end %>
</div>
@ -31,4 +33,4 @@
</div>
</div>
</div>
</div>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -4,8 +4,7 @@
<p><%= @room.meeting.uid %><p>
<p><%= @room.uid %><p>
<%= link_to 'Sessions', root_path %>
<%= link_to 'Recordings', root_path %>
<%= link_to 'Sessions', sessions_path %>
<%= link_to 'Settings', root_path %>
<p>Click below to join the meeting.</p>
@ -18,4 +17,4 @@
<br><br>
<%= link_to 'Logout', logout_path %>
<%= link_to 'Logout', logout_path %>