Skip to content
Snippets Groups Projects
Verified Commit 298ecdce authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Ovladani nahravani

parent e7d34a20
Branches
No related tags found
No related merge requests found
......@@ -8,22 +8,56 @@
data-url="/api/streams?live=true">
<thead>
<tr>
<th data-field="name" data-width="70" data-width-unit="%">Stream</th>
<th data-field="name" data-width="60" data-width-unit="%">Stream</th>
<th data-field="publish_user_name" data-width="30" data-width-unit="%">Vysílá</th>
<th data-field="recording" data-width="10" data-width-unit="%" data-formatter="formatterRecording">Nahrávání</th>
</tr>
</thead>
</table>
</div>
<script>
$('#Streams').bootstrapTable({
onClickRow: function (row) {
onClickCell: function (field, value, row, $element) {
if ( field == 'recording' ) {
if ( row.is_recordable ) {
$.ajax({
method: 'put',
url: '/streams/' + row.id + '/recording',
data: { action: (value ? 'stop':'start') },
success: function(rc) {
var content = formatterRecording(rc.recording, row);
$element.html(content);
}
});
}
}
else {
window.location.href = '/play/' + row.key;
}
},
formatNoMatches: function() { return '<p class="text-4xl">Aktuálně neprobíhá žádné živé vysílání</p>' },
});
function formatterRecording(value, row) {
if ( value == 0 ) {
var title = row.is_recordable ? 'Zapnout nahrávání':'Vypnuto';
return '<i class="fa fa-toggle-off text-3xl" title="'+title+'"></i>';
}
else {
var title = row.is_recordable ? 'Vypnout nahrávání':'Zapnuto';
return '<i class="fa fa-toggle-on text-3xl" title="'+title+'"></i>';
}
}
function rowStyle(row, index) {
return {
css: {
cursor: 'pointer'
}
}
}
setInterval(
function() {
$('#Streams').bootstrapTable('refresh', {silent: true})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment