forked from External/greenlight
minor fixes
This commit is contained in:
parent
bc9c2c1232
commit
83642f22c1
|
@ -1,20 +1,20 @@
|
||||||
class RoomsController < ApplicationController
|
class RoomsController < ApplicationController
|
||||||
|
|
||||||
before_action :find_room, except: :create
|
before_action :find_room, except: :create
|
||||||
before_action :verify_room_ownership, only: [:start, :destroy, :home]
|
before_action :verify_room_ownership, except: [:create, :show, :join, :logout]
|
||||||
|
|
||||||
META_LISTED = "gl-listed"
|
META_LISTED = "gl-listed"
|
||||||
|
|
||||||
# POST /r
|
# POST /r
|
||||||
def create
|
def create
|
||||||
room = Room.new(name: room_params[:name])
|
@room = Room.new(name: room_params[:name])
|
||||||
room.owner = current_user
|
@room.owner = current_user
|
||||||
|
|
||||||
if room.save
|
if @room.save
|
||||||
if room_params[:auto_join] == "1"
|
if room_params[:auto_join] == "1"
|
||||||
redirect_to start_room_path(room)
|
start
|
||||||
else
|
else
|
||||||
redirect_to room
|
redirect_to @room
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Handle room didn't save.
|
# Handle room didn't save.
|
||||||
|
@ -28,7 +28,6 @@ class RoomsController < ApplicationController
|
||||||
@recordings = @room.recordings
|
@recordings = @room.recordings
|
||||||
@is_running = @room.is_running?
|
@is_running = @room.is_running?
|
||||||
else
|
else
|
||||||
@recordings = @room.public_recordings
|
|
||||||
render :join
|
render :join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -38,9 +37,9 @@ class RoomsController < ApplicationController
|
||||||
opts = default_meeting_options
|
opts = default_meeting_options
|
||||||
|
|
||||||
# Assign join name if passed.
|
# Assign join name if passed.
|
||||||
if params[@room.invite_path][:join_name]
|
if params[@room.invite_path]
|
||||||
@join_name = params[@room.invite_path][:join_name]
|
@join_name = params[@room.invite_path][:join_name]
|
||||||
else
|
elsif !params[:join_name]
|
||||||
# Join name not passed.
|
# Join name not passed.
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -49,7 +48,7 @@ class RoomsController < ApplicationController
|
||||||
if current_user
|
if current_user
|
||||||
redirect_to @room.join_path(current_user.name, opts, current_user.uid)
|
redirect_to @room.join_path(current_user.name, opts, current_user.uid)
|
||||||
else
|
else
|
||||||
join_name = params[@room.invite_path][:join_name]
|
join_name = params[:join_name] || params[@room.invite_path][:join_name]
|
||||||
redirect_to @room.join_path(join_name, opts)
|
redirect_to @room.join_path(join_name, opts)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -152,7 +151,7 @@ class RoomsController < ApplicationController
|
||||||
def bring_to_room
|
def bring_to_room
|
||||||
if current_user
|
if current_user
|
||||||
# Redirect authenticated users to their room.
|
# Redirect authenticated users to their room.
|
||||||
redirect_to room_path(current_user.room.uid)
|
redirect_to room_path(current_user.room)
|
||||||
else
|
else
|
||||||
# Redirect unauthenticated users to root.
|
# Redirect unauthenticated users to root.
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
|
|
|
@ -77,13 +77,12 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def subtitle
|
# Retrives a list of all a users rooms that are not the main room, sorted by last session date.
|
||||||
case provider
|
def secondary_rooms
|
||||||
when "greenlight", "google", "twitter"
|
secondary = (rooms - [main_room])
|
||||||
"User"
|
no_session, session = secondary.partition do |r| r.last_session.nil? end
|
||||||
else
|
sorted = session.sort_by do |r| r.last_session end
|
||||||
"Unknown"
|
session + no_session
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def firstname
|
def firstname
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%= render 'shared/room_event' do %>
|
<%= render 'shared/room_event' do %>
|
||||||
<%= form_for room_path, method: :post do |f| %>
|
<%= form_for room_path(@room), method: :post do |f| %>
|
||||||
<div class="input-group" style="height: 48px;">
|
<div class="input-group" style="height: 48px;">
|
||||||
<%= f.text_field :join_name,
|
<%= f.text_field :join_name,
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
@ -37,7 +37,12 @@
|
||||||
|
|
||||||
<div class="row pt-7 pb-2">
|
<div class="row pt-7 pb-2">
|
||||||
<% if current_user.rooms.length > 1 %>
|
<% if current_user.rooms.length > 1 %>
|
||||||
<% current_user.rooms.each do |room| %>
|
<div class="col-lg-4 col-md-6 col-sm-12">
|
||||||
|
<%= link_to current_user.main_room do %>
|
||||||
|
<%= render "shared/components/room_block", room: current_user.main_room %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% current_user.secondary_rooms.each do |room| %>
|
||||||
<div class="col-lg-4 col-md-6 col-sm-12">
|
<div class="col-lg-4 col-md-6 col-sm-12">
|
||||||
<%= link_to room do %>
|
<%= link_to room do %>
|
||||||
<%= render "shared/components/room_block", room: room %>
|
<%= render "shared/components/room_block", room: room %>
|
||||||
|
|
|
@ -37,7 +37,7 @@ var request_to_join_meeting = function(){
|
||||||
},
|
},
|
||||||
error: function(){
|
error: function(){
|
||||||
// The meeting is still booting (going slowly), retry shortly.
|
// The meeting is still booting (going slowly), retry shortly.
|
||||||
if(join_attempts < 4){ setTimeout(request_to_join_meeting, 5000); }
|
if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); }
|
||||||
join_attempts++;
|
join_attempts++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,4 +25,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render "shared/sessions", recordings: @recordings, only_public: true %>
|
<%= render "shared/sessions", recordings: @room.public_recordings, only_public: true %>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<span class="input-icon-addon">
|
<span class="input-icon-addon">
|
||||||
<i class="fas fa-chalkboard-teacher"></i>
|
<i class="fas fa-chalkboard-teacher"></i>
|
||||||
</span>
|
</span>
|
||||||
<%= f.text_field :name, id: "room-name", class: "form-control", placeholder: "Enter a room name...", autocomplete: :off %>
|
<%= f.text_field :name, id: "room-name", class: "form-control", value: "", placeholder: "Enter a room name...", autocomplete: :off %>
|
||||||
<div class="invalid-feedback text-left">Room name cannot be blank.</div>
|
<div class="invalid-feedback text-left">Room name cannot be blank.</div>
|
||||||
</div>
|
</div>
|
||||||
<label class="custom-switch mt-5 mb-5 float-left">
|
<label class="custom-switch mt-5 mb-5 float-left">
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<%= f.label "Fullname", class: "form-label" %>
|
<%= f.label "Fullname", class: "form-label" %>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<%= f.text_field :name, class: "form-control #{form_is_invalid?(@user, :name)}", value: @user.name, placeholder: "Fullname" %>
|
<%= f.text_field :name, class: "form-control #{form_is_invalid?(@user, :name)}", placeholder: "Fullname" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<%= f.label "Email", class: "form-label" %>
|
<%= f.label "Email", class: "form-label" %>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<%= f.text_field :email, class: "form-control #{form_is_invalid?(@user, :email)}", value: @user.email, placeholder: "Email" %>
|
<%= f.text_field :email, class: "form-control #{form_is_invalid?(@user, :email)}", placeholder: "Email" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-10" style="transform: translateY(25%);">
|
<div class="col-10" style="transform: translateY(25%);">
|
||||||
<%= f.text_field :image, class: "form-control #{form_is_invalid?(@user, :image)}", value: @user.image, placeholder: "Profile Image URL" %>
|
<%= f.text_field :image, class: "form-control #{form_is_invalid?(@user, :image)}", placeholder: "Profile Image URL" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue