Added seasons collapsing to episodes view.

pull/936/head
Louis Vézina 5 years ago
parent a3723a1437
commit 11d93f61db

@ -323,6 +323,8 @@
getLanguages(); getLanguages();
getEnabledLanguages(); getEnabledLanguages();
var collapsedGroups = {};
var table = $('#episodes').DataTable({ var table = $('#episodes').DataTable({
dom: "tr", dom: "tr",
processing: true, processing: true,
@ -338,8 +340,18 @@
pageLength: {{ settings.general.page_size }}, pageLength: {{ settings.general.page_size }},
ajax: "{{ url_for('api.episodes') }}?seriesid={{id}}", ajax: "{{ url_for('api.episodes') }}?seriesid={{id}}",
rowGroup: { rowGroup: {
dataSrc: function (data) { dataSrc: 'season',
return 'Season ' + data.season; startRender: function (rows, group) {
var collapsed = !!collapsedGroups[group];
rows.nodes().each(function (r) {
r.style.display = collapsed ? 'none' : '';
});
return $('<tr/>')
.append('<td colspan=' + rows.columns()[0].length + '>Season ' + group + '</td>')
.attr('data-name', group)
.toggleClass('collapsed', collapsed);
} }
}, },
columns: [ columns: [
@ -424,6 +436,12 @@
] ]
}); });
$('#episodes').on('click', 'tr.dtrg-start', function () {
var name = $(this).data('name');
collapsedGroups[name] = !collapsedGroups[name];
table.draw(false);
});
$('#episodes').on('click', '.remove_subtitles', function (e) { $('#episodes').on('click', '.remove_subtitles', function (e) {
$(this).tooltip('dispose'); $(this).tooltip('dispose');
e.preventDefault(); e.preventDefault();

Loading…
Cancel
Save