Add tabs for history and export on info pages

This commit is contained in:
JonnyWong16 2020-10-02 10:14:00 -07:00
parent fc39f1521d
commit dd4c0d24b7
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -261,19 +261,20 @@ DOCUMENTATION :: END
</div>
<div class="summary-content-wrapper">
<div class="col-md-9">
% if data['media_type'] == 'movie' or data['live']:
<div class="summary-content-padding hidden-xs hidden-sm" style="height: 305px;">
% elif data['media_type'] in ('show', 'season', 'collection'):
<div class="summary-content-padding hidden-xs hidden-sm" style="height: 270px;">
% elif data['media_type'] == 'episode':
<div class="summary-content-padding hidden-xs hidden-sm" style="height: 70px;">
% elif data['media_type'] in ('artist', 'album', 'playlist', 'photo_album', 'photo',):
<div class="summary-content-padding hidden-xs hidden-sm" style="height: 150px;">
% elif data['media_type'] in ('track', 'clip'):
<div class="summary-content-padding hidden-xs hidden-sm" style="height: 180px;">
% else:
<div class="summary-content-padding hidden-xs hidden-sm">
% endif
<%
padding_height = ''
if data['media_type'] == 'movie' or data['live']:
padding_height = 'height: 305px;'
elif data['media_type'] in ('show', 'season', 'collection'):
padding_height = 'height: 270px;'
elif data['media_type'] == 'episode':
padding_height = 'height: 70px;'
elif data['media_type'] in ('artist', 'album', 'playlist', 'photo_album', 'photo'):
padding_height = 'height: 150px;'
elif data['media_type'] in ('track', 'clip'):
padding_height = 'height: 180px;'
%>
<div class="summary-content-padding hidden-xs hidden-sm" style="${padding_height}">
% if data['media_type'] in ('movie', 'episode', 'track', 'clip'):
<div class="summary-content-media-info-wrapper">
% if data['media_type'] != 'track' and media_info['video_codec']:
@ -516,7 +517,28 @@ DOCUMENTATION :: END
</div>
</div>
% endif
% if data['media_type'] not in ('photo_album', 'photo', 'clip', 'collection', 'playlist'):
<%
history_type = data['media_type'] in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track')
history_active = 'active' if history_type else ''
export_active = 'active' if not history_type else ''
%>
% if history_type:
<div class="col-md-12">
<div class="table-card-header">
<ul class="nav-list nav-pills" role="tablist">
<li class="${history_active}"><a href="#tabs-history" role="tab" data-toggle="tab">History</a></li>
% if _session['user_group'] == 'admin':
<li class="${export_active}"><a href="#tabs-export" role="tab" data-toggle="tab">Export</a></li>
% endif
</ul>
</div>
</div>
% endif
<div class="tab-content">
% if history_type:
<div role="tabpanel" class="tab-pane ${history_active}" id="tabs-history">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="table-card-header">
<div class="header-bar">
@ -603,8 +625,14 @@ DOCUMENTATION :: END
</table>
</div>
</div>
</div>
</div>
</div>
% endif
% if not data['live'] and _session['user_group'] == 'admin':
<div role="tabpanel" class="tab-pane ${export_active}" id="tabs-export">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="table-card-header">
<div class="header-bar">
@ -647,11 +675,15 @@ DOCUMENTATION :: END
</table>
</div>
</div>
</div>
</div>
</div>
% endif
</div>
</div>
</div>
</div>
</div>
% endif
</%def>
@ -818,15 +850,24 @@ DOCUMENTATION :: END
}
</script>
% endif
% if data['media_type'] not in ('photo_album', 'photo', 'clip', 'collection', 'playlist'):
% if data['media_type'] in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track'):
<script>
$(document).ready(function () {
function loadHistoryTable() {
get_history();
history_table = $('#history_table-RK-${data["rating_key"]}').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 12] });
$(colvis.button()).appendTo('#button-bar-history');
clearSearchButton('history_table-RK-${data["rating_key"]}', history_table);
}
$(document).ready(function () {
loadHistoryTable();
});
$("#refresh-history-list").click(function () {
history_table.draw();
});
$('#row-edit-mode').on('click', function() {
$('#row-edit-mode-alert').fadeIn(200);
@ -863,11 +904,6 @@ DOCUMENTATION :: END
});
}
});
});
$("#refresh-history-list").click(function () {
history_table.draw();
});
// Send recently added notification
$('#send-recently-added-notification').on('click', function () {
@ -927,6 +963,24 @@ DOCUMENTATION :: END
</script>
% endif
<script>
$(document).ready(function () {
// Javascript to enable link to tab
var hash = document.location.hash;
var prefix = "tab_";
if (hash) {
$('.nav-list a[href=' + hash.replace(prefix, "") + ']').tab('show').trigger('show.bs.tab');
}
// Change hash for page-reload
$('.nav-list a').on('shown.bs.tab', function (e) {
window.location.hash = e.target.hash.replace("#", "#" + prefix);
});
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
});
$('.metadata-xml').on('tripleclick', function () {
openPlexXML("/library/metadata/${data['rating_key']}");
});
@ -987,12 +1041,20 @@ DOCUMENTATION :: END
clearSearchButton('export_table-RK-${data["rating_key"]}', export_table);
}
$("#refresh-export-table").click(function () {
export_table.draw();
$(document).ready(function () {
if ($('#tabs-history').length) {
$('a[href="#tabs-export"]').on('shown.bs.tab', function() {
if (typeof(export_table) === 'undefined') {
loadExportTable();
}
});
} else {
loadExportTable();
}
});
$(document).ready(function () {
loadExportTable();
$("#refresh-export-table").click(function () {
export_table.draw();
});
</script>
% if data.get('poster_url'):