forked from External/greenlight
add room post
This commit is contained in:
parent
de44d8024b
commit
9e5250353b
|
@ -22,7 +22,7 @@ class RoomsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# GET/POST /r/:room_uid
|
||||
# GET /r/:room_uid
|
||||
def show
|
||||
opts = default_meeting_options
|
||||
|
||||
|
@ -34,13 +34,8 @@ class RoomsController < ApplicationController
|
|||
redirect_to @room.join_path(current_user, opts)
|
||||
end
|
||||
else
|
||||
# If you're unauthenticated, you must enter a name to join the meeting.
|
||||
if params[:join_name]
|
||||
redirect_to @room.join_path(params[:join_name], opts)
|
||||
else
|
||||
# Render the join page so they can supply their name.
|
||||
render :join
|
||||
end
|
||||
# Render the join page so they can supply their name.
|
||||
render :join
|
||||
end
|
||||
else
|
||||
# If the meeting isn't running and you don't own the room, go to the waiting page.
|
||||
|
@ -50,6 +45,16 @@ class RoomsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# POST /r/:room_uid
|
||||
def join
|
||||
opts = default_meeting_options
|
||||
|
||||
# If you're unauthenticated, you must enter a name to join the meeting.
|
||||
if params[:join_name]
|
||||
redirect_to @room.join_path(params[:join_name], opts)
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /r/:room_uid
|
||||
def destroy
|
||||
@room.destroy
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
Rails.application.routes.draw do
|
||||
|
||||
# Room resources.
|
||||
resources :rooms, only: [:create, :show, :destroy], param: :room_uid, path: '/r'
|
||||
|
||||
# Room routes.
|
||||
# Extended room routes.
|
||||
scope '/r/:room_uid' do
|
||||
post '/', to: 'rooms#join'
|
||||
get '/start', to: 'rooms#start', as: :start_room
|
||||
match '/wait', to: 'rooms#wait', as: :wait_room, via: [:get, :post]
|
||||
get '/logout', to: 'rooms#logout', as: :logout_room
|
||||
|
|
Loading…
Reference in New Issue