80 lines
2.0 KiB
HTML
80 lines
2.0 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block container %}
|
|
|
|
<table id="tableSeances" class="table table-striped table-hover"></table>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
function getFilms(callback){
|
|
$("#tableSeances").DataTable( {
|
|
"ajax": {
|
|
"url": "{{ url_for('get_videos') }}",
|
|
"dataSrc": ""
|
|
},
|
|
"order": [[ 2, "asc" ]],
|
|
"columns": [
|
|
{ "data": "name" },
|
|
{ "data": "views" },
|
|
{ "data": "created_at" },
|
|
],
|
|
"columnDefs": [{
|
|
"targets": 0,
|
|
"title": "Titre",
|
|
"data": "name",
|
|
"render": function (data, type, row, meta) {
|
|
return '<a href="' + gen_link_video(row['uuid']) + '">' + data + '</a>';
|
|
}},
|
|
{
|
|
"targets": 1,
|
|
"title": "Vues",
|
|
"data": "views",
|
|
"render": function (data, type, row, meta) {
|
|
return data;
|
|
}},
|
|
{
|
|
"targets": 2,
|
|
"title": "Date upload",
|
|
"data": "created_at",
|
|
"render": function (data, type, row, meta) {
|
|
return hr_date(data);
|
|
}}
|
|
]
|
|
});
|
|
callback();
|
|
}
|
|
|
|
function gen_link_video(uuid){
|
|
return 'https://cinematheque.tube/videos/watch/' + uuid;
|
|
}
|
|
|
|
function gen_iframe(name, embed_path){
|
|
iframe = '<iframe allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups" src="https://cinematheque.tube' + embed_path + '?title=0&warningTitle=0" title="' + name + '" frameborder="0"></iframe>';
|
|
return escapeHtml(iframe);
|
|
}
|
|
|
|
function hr_date(datetz){
|
|
var date = new Date(datetz).toLocaleString();
|
|
return date;
|
|
};
|
|
|
|
function escapeHtml(text) {
|
|
var map = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
"'": '''
|
|
};
|
|
|
|
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
|
|
}
|
|
|
|
$( document ).ready(function() {
|
|
getFilms();
|
|
});
|
|
|
|
</script>
|
|
{% endblock %}
|