properly generate some urls

This commit is contained in:
Zachary Chai 2017-02-07 14:14:39 -05:00
parent bfbdfc645e
commit b09ec1fc69
9 changed files with 20 additions and 15 deletions

View File

@ -26,8 +26,7 @@ class @Meeting
if _meetingInstance
return _meetingInstance
meetingId = $(".page-wrapper").data('id')
if (type = location.pathname.split('/')[1]) != 'rooms'
type = 'meetings'
type = $("body").data('resource')
name = $('.meeting-user-name').val()
adminId = $(".page-wrapper").data('admin-id')
_meetingInstance = new Meeting(meetingId, type, name, adminId)
@ -42,9 +41,9 @@ class @Meeting
fullId = encodeURIComponent(adminId) + '/' + encodeURIComponent(meetingId)
else
fullId = encodeURIComponent(meetingId)
return @buildFullDomainURL() + '/' + type + '/' + fullId
return @buildRootURL() + '/' + type + '/' + fullId
@buildFullDomainURL: ->
@buildRootURL: ->
url = location.protocol + '//' + location.hostname
if location.port
url += ':' + location.port

View File

@ -238,7 +238,7 @@ class @Recordings
getRecordingsURL: ->
if $(".page-wrapper.rooms").data('main-room')
base_url = '/rooms/'+Meeting.getInstance().getAdminId()
base_url = Meeting.buildRootURL()+'/'+$('body').data('resource')+'/'+Meeting.getInstance().getAdminId()
else
base_url = $('.meeting-url').val()
base_url+'/recordings'

View File

@ -43,6 +43,10 @@ module ApplicationHelper
end
end
def omniauth_login_url(provider)
"/auth/#{provider}"
end
# Whether the current page is the page of a room/meeting or not
def on_room_or_meeting_page?
params[:id].present?

View File

@ -38,7 +38,7 @@
<% else %>
<div class="text-center">
<div><%= t('are_you', name: @user.name) %></div>
<div class=""><%= link_to t('login'), '/users/login' %></div>
<div class=""><%= link_to t('login'), user_login_url %></div>
</div>
<% end %>
</div>

View File

@ -26,7 +26,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
</head>
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>">
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>" data-resource="<%= params[:resource] %>">
<!-- Messages -->
<div id='alerts'>
</div>

View File

@ -26,7 +26,7 @@
<%= render layout: 'shared/center_panel' do %>
<div class="center-block center-panel-content-size col-xs-12">
<% if omniauth_providers_configured(:twitter) %>
<%= link_to '/auth/twitter', class: "signin-link signin-link-twitter" do %>
<%= link_to omniauth_login_url(:twitter), class: "signin-link signin-link-twitter" do %>
<div class="signin-button center-block">
<div class="signin-icon-wrapper">
<%= image_tag("twitter_signin_logo.png", alt: "T", class: "signin-icon") %>
@ -38,7 +38,7 @@
<% end %>
<% end %>
<% if omniauth_providers_configured(:google) %>
<%= link_to '/auth/google', class: "signin-link signin-link-google" do %>
<%= link_to omniauth_login_url(:google), class: "signin-link signin-link-google" do %>
<div class="signin-button center-block">
<div class="signin-icon-wrapper">
<%= image_tag("g-normal.png", alt: "G", class: "signin-icon") %>

View File

@ -26,7 +26,7 @@
<% else %>
<div class="text-center">
<span><%= t('login_description') %></span>
<div><%= link_to t('login'), '/users/login' %></div>
<div><%= link_to t('login'), user_login_url %></div>
</div>
<% end %>
</span>

View File

@ -19,7 +19,7 @@ Rails.application.routes.draw do
mount ActionCable.server => '/cable'
resources :users, only: [:edit, :update]
get '/users/login', to: 'sessions#new'
get '/users/login', to: 'sessions#new', as: :user_login
get '/users/logout', to: 'sessions#destroy', as: :user_logout
match '/auth/:provider/callback', to: 'sessions#create', via: [:get, :post]
@ -28,24 +28,24 @@ Rails.application.routes.draw do
# There are two resources [meetings|rooms]
# meetings offer a landing page for NON authenticated users to create and join session in BigBlueButton
# rooms offer a customized landing page for authenticated users to create and join session in BigBlueButton
scope '/:resource' do
scope '/:resource', constraints: {resource: /meetings|rooms/} do
# room specific routes
scope '/:room_id' do
# recording routes for updating, deleting and viewing recordings
get '/(:id)/recordings', to: 'bbb#recordings', defaults: {id: nil, format: 'json'}
patch '/(:id)/recordings/:record_id', to: 'bbb#update_recordings', defaults: {id: nil, format: 'json'}
delete '/(:id)/recordings/:record_id', to: 'bbb#delete_recordings', defaults: {id: nil, format: 'json'}
# room specific routes
delete '/:id/end', to: 'bbb#end', defaults: {format: 'json'}
get '/:id/wait', to: 'landing#wait_for_moderator'
get '/:id/session_status_refresh', to: 'landing#session_status_refresh'
end
# routes shared between meetings and rooms
get '/(:room_id)/:id', to: 'landing#resource', defaults: {room_id: nil}
get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'}
get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}
post '/:id/callback', to: 'bbb#callback' #, defaults: {format: 'json'}
end
root to: 'landing#index', :resource => 'meetings'

View File

@ -10,6 +10,8 @@ services:
- '.:/usr/src/app'
volumes_from:
- gem_cache
env_file:
- .env
expose:
- '3001'
stdin_open: true