forked from External/greenlight
Refactored meetings resource and breaked up view into components
This commit is contained in:
parent
855746dc08
commit
061f9c794a
|
@ -15,6 +15,7 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#url_form_button').click (function (event) {
|
||||
$.ajax({
|
||||
url : $(this).data ('url'),
|
||||
|
@ -36,7 +37,7 @@
|
|||
|
||||
$(document).on("turbolinks:load", function() {
|
||||
if ($("body[data-controller=landing]").get(0)) {
|
||||
if ($("body[data-action=index]").get(0)) {
|
||||
if ($("body[data-action=meeting]").get(0) || $("body[data-action=room]").get(0)) {
|
||||
initIndex();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class BbbController < ApplicationController
|
|||
elsif ( !params.has_key?(:name) )
|
||||
render_response("missing_parameter", "user name was not included", :bad_request)
|
||||
else
|
||||
bbb_join_url = helpers.bbb_join_url(params[:id], false, params[:name], false)
|
||||
bbb_join_url = helpers.bbb_join_url(params[:id], false, params[:name], false, )
|
||||
if bbb_join_url[:returncode]
|
||||
logger.info "#Execute the redirect"
|
||||
render_response("ok", "execute the redirect", :ok, {:join_url => bbb_join_url[:join_url]})
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
class LandingController < ApplicationController
|
||||
|
||||
def index
|
||||
@refreshable = (params[:resource] == 'meeting' && !params.has_key?(:id))
|
||||
def meeting
|
||||
@refreshable = (params[:resource] == 'meetings' && !params.has_key?(:id))
|
||||
@meeting_token = params[:id] || @meeting_token = helpers.new_meeting_token
|
||||
@meeting_url = landing_url(@meeting_token)
|
||||
@resource_url = meeting_url(@meeting_token)
|
||||
end
|
||||
|
||||
# GET /token.json
|
||||
def new_meeting
|
||||
respond_to do |format|
|
||||
meeting_url = landing_url(helpers.new_meeting_token)
|
||||
meeting_url = meeting_url(helpers.new_meeting_token)
|
||||
format.json { render :json => { :messageKey => "ok", :message => "New meeting URL created", :status => :ok, :response => { :meeting_url => meeting_url} }, :status => status }
|
||||
end
|
||||
end
|
||||
|
||||
def room
|
||||
@room_name = params[:name]
|
||||
@meeting_token = @room_name
|
||||
@resource_url = room_url(@meeting_token)
|
||||
@user = User.find_by(username: @room_name)
|
||||
if @user.nil?
|
||||
redirect_to root_path
|
||||
|
|
|
@ -13,7 +13,7 @@ module BbbHelper
|
|||
return password
|
||||
end
|
||||
|
||||
def bbb_join_url(meeting_token, meeting_recorded=false, user_fullname='User', user_is_moderator=false)
|
||||
def bbb_join_url(meeting_token, meeting_recorded=false, user_fullname='User', user_is_moderator=false, meeting_logout_url=nil)
|
||||
bbb ||= BigBlueButton::BigBlueButtonApi.new(bbb_endpoint + "api", bbb_secret, "0.8", true)
|
||||
if !bbb
|
||||
return { :returncode => false, :messageKey => "BBBAPICallInvalid", :message => "BBB API call invalid." }
|
||||
|
@ -28,7 +28,7 @@ module BbbHelper
|
|||
logger.info "Message for the log file #{exc.key}: #{exc.message}"
|
||||
|
||||
# Prepare parameters for create
|
||||
logout_url = "#{request.base_url}/meeting/#{meeting_token}"
|
||||
logout_url = meeting_logout_url || logout_url = "#{request.base_url}"
|
||||
moderator_password = random_password(12)
|
||||
viewer_password = random_password(12)
|
||||
meeting_options = {:record => meeting_recorded.to_s, :logoutURL => logout_url, :moderatorPW => moderator_password, :attendeePW => viewer_password }
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<div id="landing_page_footer_message">
|
||||
<p>Bookmark this page to reuse this meeting URL, or click refresh button to generate a new meeting URL</p>
|
||||
</div>
|
|
@ -0,0 +1,19 @@
|
|||
<div id="landing_page_footer_oauth_append">
|
||||
<% if current_user.nil? %>
|
||||
<p>You can have a personal URL (with recordings) by signing in below</p>
|
||||
|
||||
<div class="text-center">
|
||||
<%= link_to('/auth/twitter', :class => "btn icon btn-lg btn-social-icon btn-twitter") do %>
|
||||
<span class="fa fa-twitter"></span>
|
||||
<% end %>
|
||||
<%= link_to('/auth/google', :class => "btn icon btn-lg btn-social-icon btn-google") do %>
|
||||
<span class="fa fa-google"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div>Hello <%= current_user.name %></div>
|
||||
<div><%= link_to 'Personal Room', current_user.room_url %></div>
|
||||
<div><%= link_to 'Logout', '/logout' %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,28 @@
|
|||
<div class="jumbotron">
|
||||
<!-- Meeting URL -->
|
||||
<h4 class="display-3">
|
||||
<div id="landing_page_url" class="center-block">
|
||||
<form id="url_form" class="form-inline">
|
||||
<div class="form-group">
|
||||
<span id="meeting_url"><%= @resource_url %></span>
|
||||
</div>
|
||||
<% if @refreshable %>
|
||||
<button id="url_form_button" type="button" class="btn btn-default" data-url="<%= new_meeting_path() %>">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
<% end %>
|
||||
</form>
|
||||
</div>
|
||||
</h4>
|
||||
|
||||
<!-- Join form -->
|
||||
<div id="landing_page_join">
|
||||
<form id="join_form" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="join_form_name" class="sr-only">Name</label>
|
||||
<input id="join_form_name" type="text" class="form-control input" id="name" placeholder="Your name" required>
|
||||
</div>
|
||||
<button id="join_form_button" type="button" class="btn btn-success" data-url="<%= bbb_join_path(@meeting_token) %>">Join</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
<figure class=highlight><pre><figcaption class="text" data-lang="text">
|
||||
<p>Hi Everyone</p>
|
||||
<p>The meeting will be at this URL</p>
|
||||
<p><a id="text_meeting_url" href="<%= @resource_url %>"><%= @resource_url %></a></p>
|
||||
<p>Please join!</p>
|
||||
</figcaption></pre></figure>
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
<!-- Body -->
|
||||
<div class='body'>
|
||||
|
||||
<div class="container">
|
||||
<div class="jumbotron">
|
||||
<!-- Meeting URL -->
|
||||
<% if @refreshable %>
|
||||
<h4 class="display-3">
|
||||
<div id="landing_page_url" class="center-block">
|
||||
<form id="url_form" class="form-inline">
|
||||
<div class="form-group">
|
||||
<span id="meeting_url"><%= @meeting_url %></span>
|
||||
</div>
|
||||
<button id="url_form_button" type="button" class="btn btn-default" data-url="<%= new_meeting_url() %>">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</h4>
|
||||
<% end %>
|
||||
|
||||
<!-- Join form -->
|
||||
<div id="landing_page_join">
|
||||
<form id="join_form" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="join_form_name" class="sr-only">Name</label>
|
||||
<input id="join_form_name" type="text" class="form-control input" id="name" placeholder="Your name" required>
|
||||
</div>
|
||||
<button id="join_form_button" type="button" class="btn btn-success" data-url="<%= bbb_join_path(@meeting_token) %>">Join</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<figure class=highlight><pre><figcaption class="text" data-lang="text">
|
||||
<p>Hi Everyone</p>
|
||||
<p>The meeting will be at this URL</p>
|
||||
<p><a id="text_meeting_url" href="<%= @meeting_url %>"><%= @meeting_url %></a></p>
|
||||
<p>Please join!</p>
|
||||
</figcaption></pre></figure>
|
||||
|
||||
<div id="landing_page_footer_message">
|
||||
<p>Bookmark this page to reuse this meeting URL, or click refresh button to generate a new meeting URL</p>
|
||||
</div>
|
||||
|
||||
<div id="landing_page_footer_oauth_append">
|
||||
<% if current_user.nil? %>
|
||||
<p>You can have a personal URL (with recordings) by signing in below</p>
|
||||
|
||||
<div class="text-center">
|
||||
<%= link_to('/auth/twitter', :class => "btn icon btn-lg btn-social-icon btn-twitter") do %>
|
||||
<span class="fa fa-twitter"></span>
|
||||
<% end %>
|
||||
<%= link_to('/auth/google', :class => "btn icon btn-lg btn-social-icon btn-google") do %>
|
||||
<span class="fa fa-google"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div>Hello <%= current_user.name %></div>
|
||||
<div><%= link_to 'Personal Room', current_user.room_url %></div>
|
||||
<div><%= link_to 'Logout', '/logout' %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,14 @@
|
|||
<!-- Body -->
|
||||
<div class='body'>
|
||||
|
||||
<div class="container">
|
||||
<%= render 'landing/join_form' %>
|
||||
|
||||
<%= render 'landing/sharing_text' %>
|
||||
|
||||
<%= render 'landing/footer_message' %>
|
||||
|
||||
<%= render 'landing/footer_oauth_append' %>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -1,19 +1,26 @@
|
|||
<div class="page-wrapper room">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 col-sm-offset-10">
|
||||
<% if admin? %>
|
||||
<span class="user"><%= current_user.name %></span>
|
||||
<%= link_to "Logout", "/logout" %>
|
||||
<% else %>
|
||||
<%= link_to "Login", "/auth/twitter" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-sm-offset-4">
|
||||
<div class="room-link">
|
||||
Room Link: <%= link_to "/rooms/#{@room_name}", "/rooms/#{@room_name}" %>
|
||||
<!-- Body -->
|
||||
<div class='body'>
|
||||
|
||||
<div class="page-wrapper room">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 col-sm-offset-10">
|
||||
<% if admin? %>
|
||||
<span class="user"><%= current_user.name %></span>
|
||||
<%= link_to "Logout", "/logout" %>
|
||||
<% else %>
|
||||
<%= link_to "Login", "/auth/twitter" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= render 'landing/join_form' %>
|
||||
|
||||
<%= render 'landing/sharing_text' %>
|
||||
|
||||
<%= render 'landing/footer_message' %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
Rails.application.routes.draw do
|
||||
get 'bbb/join/:id', to: 'bbb#join', as: :bbb_join
|
||||
|
||||
get '/meeting/new', to: 'landing#new_meeting', as: :new_meeting
|
||||
get '/meeting(/:id)', to: 'landing#index', as: :landing, :resource => "meeting"
|
||||
get '/meetings/new', to: 'landing#new_meeting', as: :new_meeting
|
||||
get '/meetings(/:id)', to: 'landing#meeting', as: :meeting, :resource => "meetings"
|
||||
get '/rooms/:name', to: 'landing#room', as: :room, :resource => "rooms"
|
||||
|
||||
get '/auth/:provider/callback', to: 'sessions#create'
|
||||
get '/logout', to: 'sessions#destroy'
|
||||
get '/rooms/:name', to: 'landing#room'
|
||||
|
||||
root to: 'landing#index', :resource => "meeting"
|
||||
root to: 'landing#meeting', :resource => "meetings"
|
||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue