forked from External/greenlight
open recordings in new tab and hide from viewers when unpublished
This commit is contained in:
parent
6620df9c65
commit
25bccb7699
|
@ -7,17 +7,20 @@
|
|||
},
|
||||
{
|
||||
received: function(data) {
|
||||
var table = $("#recordings").DataTable();
|
||||
var recordings = Recordings.getInstance();
|
||||
var table = recordings.table.api()
|
||||
var row = table.row("#"+data.record_id);
|
||||
if (data.action === 'update') {
|
||||
var rowData = row.data();
|
||||
rowData.published = data.published
|
||||
table.row("#"+data.record_id).data(rowData).draw();
|
||||
table.row("#"+data.record_id).data(rowData);
|
||||
recordings.draw();
|
||||
|
||||
var published = (data.published) ? 'published' : 'unpublished';
|
||||
showAlert(I18n['recording_'+published], 4000);
|
||||
} else if (data.action === 'delete') {
|
||||
row.remove().draw();
|
||||
row.remove();
|
||||
recordings.draw();
|
||||
|
||||
showAlert(I18n.recording_deleted, 4000);
|
||||
}
|
||||
|
|
|
@ -9,17 +9,19 @@ class @Recordings
|
|||
data: [],
|
||||
rowId: 'id',
|
||||
paging: false,
|
||||
searching: false,
|
||||
dom: 'lrtip',
|
||||
info: false,
|
||||
order: [[ 0, "desc" ]],
|
||||
language: {
|
||||
emptyTable: I18n.no_recordings
|
||||
emptyTable: I18n.no_recordings,
|
||||
zeroRecords: I18n.no_recordings
|
||||
},
|
||||
columns: [
|
||||
{ data: "start_time" },
|
||||
{ data: "previews", orderable: false },
|
||||
{ data: "duration" },
|
||||
{ data: "playbacks", orderable: false },
|
||||
{ data: "published", visible: false },
|
||||
{ data: "id", orderable: false }
|
||||
],
|
||||
columnDefs: [
|
||||
|
@ -38,8 +40,9 @@ class @Recordings
|
|||
render: (data, type, row) ->
|
||||
if type == 'display'
|
||||
str = ''
|
||||
for d in data
|
||||
str += '<img height="50" width="50" src="'+d.url+'" alt="'+d.alt+'"></img> '
|
||||
if row.published
|
||||
for d in data
|
||||
str += '<img height="50" width="50" src="'+d.url+'" alt="'+d.alt+'"></img> '
|
||||
return str
|
||||
return data
|
||||
},
|
||||
|
@ -50,7 +53,7 @@ class @Recordings
|
|||
str = ''
|
||||
if row.published
|
||||
for d in data
|
||||
str += '<a href="'+d.url+'">'+d.type_i18n+'</a> '
|
||||
str += '<a href="'+d.url+'" target="_blank">'+d.type_i18n+'</a> '
|
||||
return str
|
||||
return data
|
||||
},
|
||||
|
@ -95,12 +98,17 @@ class @Recordings
|
|||
@initialized: ->
|
||||
return $.fn.DataTable.isDataTable('#recordings') && _recordingsInstance
|
||||
|
||||
draw: ->
|
||||
if !@isOwner()
|
||||
@table.api().columns(4).search('true')
|
||||
@table.api().columns.adjust().draw()
|
||||
|
||||
# refresh the recordings from the server
|
||||
refresh: ->
|
||||
_this = this
|
||||
table_api = this.table.api()
|
||||
$.get "/rooms/"+Meeting.getInstance().getId()+"/recordings", (data) ->
|
||||
if !data.is_owner
|
||||
$.get "/rooms/"+Meeting.getInstance().getId()+"/recordings", (data) =>
|
||||
@setOwner(data.is_owner)
|
||||
if !@owner
|
||||
table_api.column(-1).visible(false)
|
||||
for recording in data.recordings
|
||||
totalMinutes = Math.round((new Date(recording.end_time) - new Date(recording.start_time)) / 1000 / 60)
|
||||
|
@ -109,7 +117,7 @@ class @Recordings
|
|||
return new Date(b.start_time) - new Date(a.start_time)
|
||||
table_api.clear()
|
||||
table_api.rows.add(data.recordings)
|
||||
table_api.columns.adjust().draw()
|
||||
@draw()
|
||||
|
||||
# setup click handlers for the action buttons
|
||||
setupActionHandlers: ->
|
||||
|
@ -145,3 +153,9 @@ class @Recordings
|
|||
).fail((data) ->
|
||||
btn.prop('disabled', false)
|
||||
)
|
||||
|
||||
isOwner: ->
|
||||
@owner
|
||||
|
||||
setOwner: (owner) ->
|
||||
@owner = owner
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<th><%= t('thumbnails') %></th>
|
||||
<th><%= t('duration') %></th>
|
||||
<th><%= t('views') %></th>
|
||||
<th>published</th>
|
||||
<th><%= t('actions') %></th>
|
||||
</thead>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue