main room recordings

This commit is contained in:
Zachary Chai 2017-01-31 12:10:15 -05:00
parent 9667e3757b
commit 02f59c49e6
2 changed files with 18 additions and 9 deletions

View File

@ -157,7 +157,7 @@ class @Recordings
# refresh the recordings from the server
refresh: ->
table_api = this.table.api()
$.get "/rooms/"+Meeting.getInstance().getAdminId()+"/recordings", (data) =>
$.get @getRecordingsURL(), (data) =>
@setOwner(data.is_owner)
if !@owner
table_api.column(-1).visible(false)
@ -172,11 +172,12 @@ class @Recordings
# setup click handlers for the action buttons
setupActionHandlers: ->
table_api = this.table.api()
recordingsObject = this
@getTable().on 'click', '.recording-update', (event) ->
btn = $(this)
row = table_api.row($(this).closest('tr')).data()
url = $('.meeting-url').val()
url = recordingsObject.getRecordingsURL()
id = row.id
published = btn.data('visibility') == "unlisted" ||
@ -189,7 +190,7 @@ class @Recordings
data["meta_" + GreenLight.META_LISTED] = listed.toString();
$.ajax({
method: 'PATCH',
url: url+'/recordings/'+id,
url: url+'/'+id,
data: data
}).done((data) ->
@ -200,12 +201,12 @@ class @Recordings
@getTable().on 'click', '.recording-delete', (event) ->
btn = $(this)
row = table_api.row($(this).closest('tr')).data()
url = $('.meeting-url').val()
url = recordingsObject.getRecordingsURL()
id = row.id
btn.prop('disabled', true)
$.ajax({
method: 'DELETE',
url: url+'/recordings/'+id
url: url+'/'+id
}).done((data) ->
).fail((data) ->
@ -218,6 +219,13 @@ class @Recordings
getTable: ->
@table
getRecordingsURL: ->
if $(".page-wrapper.rooms").data('main-room')
base_url = '/rooms/'+Meeting.getInstance().getAdminId()
else
base_url = $('.meeting-url').val()
base_url+'/recordings'
isOwner: ->
@owner

View File

@ -29,11 +29,12 @@ Rails.application.routes.draw do
# 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
get '/rooms/:room_id/recordings', to: 'bbb#recordings', defaults: {format: 'json'}
patch '/rooms/:id/recordings/:record_id', to: 'bbb#update_recordings', defaults: {format: 'json'}
delete '/rooms/:id/recordings/:record_id', to: 'bbb#delete_recordings', defaults: {format: 'json'}
get '/rooms/:room_id/:id', to: 'landing#resource', resource: 'rooms'
patch '/rooms/:room_id/recordings/:record_id', to: 'bbb#update_recordings', defaults: {format: 'json'}
delete '/rooms/:room_id/recordings/:record_id', to: 'bbb#delete_recordings', defaults: {format: 'json'}
get '/rooms/:room_id', to: 'landing#resource', resource: 'rooms'
get '/rooms/:room_id/recordings', to: 'bbb#recordings', defaults: {format: 'json'}
get '/rooms/:room_id/:id', to: 'landing#resource', resource: 'rooms'
delete '/rooms/:room_id/:id/end', to: 'bbb#end', defaults: {format: 'json'}
get '/:resource/:id', to: 'landing#resource', as: :resource