diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index 4948610f..380dd028 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -1722,6 +1722,11 @@ a .home-platforms-instance-box:hover { .history-title .popover.right .popover-content { padding: 5px 8px; } +.history-thumbnail { + background-position: center; + background-size: cover; + width: 80px; +} .edit-user-toggles { padding-right: 10px; } diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html index 9e1ec5f6..4146ca1e 100644 --- a/data/interfaces/default/history.html +++ b/data/interfaces/default/history.html @@ -14,7 +14,11 @@ History
-   + +   +
@@ -42,6 +46,24 @@ + @@ -68,18 +90,50 @@ clearSearchButton('history_table', history_table); - $('#row-edit-mode').click(function() { + $('#row-edit-mode').on('click', function() { + $('#delete-message').popover(); + if ($(this).hasClass('active')) { - $('.delete-control').each(function() { + if (history_to_delete.length > 0) { + $('#deleteCount').text(history_to_delete.length); + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-delete', function () { + for (var i = 0; i < history_to_delete.length; i++) { + $.ajax({ + url: 'delete_history_rows', + data: { row_id: history_to_delete[i] }, + async: true, + success: function (data) { + var msg = "User history purged"; + showMsg(msg, false, true, 2000); + } + }); + } + history_table.draw(); + }); + } + + $('.delete-control').each(function () { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).addClass('hidden'); }); + } else { + history_to_delete = []; $('.delete-control').each(function() { $(this).removeClass('hidden'); }); } }); - }); + $(window).resize(function () { + if ($('.popover').popover().is(':visible')) { + var popover = $('.popover'); + popover.addClass("noTransition"); + $('#delete-message').popover('show'); + popover.removeClass("noTransition"); + } + }); + }); diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html index 8eba3f9b..5dfc51dc 100644 --- a/data/interfaces/default/info.html +++ b/data/interfaces/default/info.html @@ -185,7 +185,11 @@ DOCUMENTATION :: END Watch History for ${data['title']}
-   + +   +
@@ -214,6 +218,24 @@ DOCUMENTATION :: END + @@ -281,12 +303,36 @@ DOCUMENTATION :: END clearSearchButton('history_table', history_table); - $('#row-edit-mode').click(function() { + $('#row-edit-mode').on('click', function() { + $('#delete-message').popover(); + if ($(this).hasClass('active')) { - $('.delete-control').each(function() { + if (history_to_delete.length > 0) { + $('#deleteCount').text(history_to_delete.length); + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-delete', function () { + for (var i = 0; i < history_to_delete.length; i++) { + $.ajax({ + url: 'delete_history_rows', + data: { row_id: history_to_delete[i] }, + async: true, + success: function (data) { + var msg = "User history purged"; + showMsg(msg, false, true, 2000); + } + }); + } + history_table.draw(); + }); + } + + $('.delete-control').each(function () { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).addClass('hidden'); }); + } else { + history_to_delete = []; $('.delete-control').each(function() { $(this).removeClass('hidden'); }); diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js index 9898cc1b..3e4b9d43 100644 --- a/data/interfaces/default/js/tables/history_table.js +++ b/data/interfaces/default/js/tables/history_table.js @@ -1,5 +1,6 @@ var date_format = 'YYYY-MM-DD'; var time_format = 'hh:mm a'; +var history_to_delete = []; $.ajax({ url: 'get_date_formats', @@ -18,7 +19,7 @@ history_table_options = { "info":"Showing _START_ to _END_ of _TOTAL_ history items", "infoEmpty":"Showing 0 to 0 of 0 entries", "infoFiltered":"(filtered from _MAX_ total entries)", - "emptyTable": "No data in table", + "emptyTable": "No data in table" }, "pagingType": "bootstrap", "stateSave": true, @@ -32,7 +33,7 @@ history_table_options = { "targets": [0], "data": null, "createdCell": function (td, cellData, rowData, row, col) { - $(td).html(''); + $(td).html(''); }, "width": "5%", "className": "delete-control no-wrap hidden", @@ -98,11 +99,11 @@ history_table_options = { if (cellData !== '') { var transcode_dec = ''; if (rowData['video_decision'] === 'transcode') { - transcode_dec = ' '; + transcode_dec = ''; } else if (rowData['video_decision'] === 'copy') { - transcode_dec = ' '; + transcode_dec = ''; } else if (rowData['video_decision'] === 'direct play' || rowData['video_decision'] === '') { - transcode_dec = ' '; + transcode_dec = ''; } $(td).html('
' + transcode_dec + ' ' + cellData + '
'); } @@ -119,16 +120,16 @@ history_table_options = { var thumb_popover = ''; if (rowData['media_type'] === 'movie') { media_type = ''; - thumb_popover = '' + cellData + ' (' + rowData['year'] + ')' + thumb_popover = '' + cellData + ' (' + rowData['year'] + ')' $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else if (rowData['media_type'] === 'episode') { media_type = ''; - thumb_popover = '' + cellData + ' \ + thumb_popover = '' + cellData + ' \ (S' + ('00' + rowData['parent_media_index']).slice(-2) + 'E' + ('00' + rowData['media_index']).slice(-2) + ')' $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else if (rowData['media_type'] === 'track') { media_type = ''; - thumb_popover = '' + cellData + ' (' + rowData['parent_title'] + ')' + thumb_popover = '' + cellData + ' (' + rowData['parent_title'] + ')' $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else { $(td).html('' + cellData + ''); @@ -225,7 +226,7 @@ history_table_options = { trigger: 'hover', placement: 'right', content: function () { - return '
'; + return '
'; } }); @@ -238,6 +239,11 @@ history_table_options = { "preDrawCallback": function(settings) { var msg = "
 Fetching rows...
"; showMsg(msg, false, false, 0) + }, + "rowCallback": function (row, rowData) { + if ($.inArray(rowData['id'], history_to_delete) !== -1) { + $(row).find('button[data-id="' + rowData['id'] + '"]').toggleClass('btn-warning').toggleClass('btn-danger'); + } } } @@ -287,16 +293,11 @@ $('#history_table').on('click', 'td.delete-control > button', function () { var row = history_table.row( tr ); var rowData = row.data(); - $(this).prop('disabled', true); - $(this).html(' Delete'); - - $.ajax({ - url: 'delete_history_rows', - data: {row_id: rowData['id']}, - async: true, - success: function(data) { - history_table.ajax.reload(null, false); - } - }); - + var index = $.inArray(rowData['id'], history_to_delete); + if (index === -1) { + history_to_delete.push(rowData['id']); + } else { + history_to_delete.splice(index, 1); + } + $(this).toggleClass('btn-warning').toggleClass('btn-danger'); }); \ No newline at end of file diff --git a/data/interfaces/default/js/tables/users.js b/data/interfaces/default/js/tables/users.js index ecd5b578..e23dac06 100644 --- a/data/interfaces/default/js/tables/users.js +++ b/data/interfaces/default/js/tables/users.js @@ -271,7 +271,6 @@ $('#users_list_table').on('click', 'td.edit-control > .edit-user-toggles > butto var row = users_list_table.row(tr); var rowData = row.data(); - //$(this).prop('disabled', true); if ($(this).hasClass('active')) { $(this).toggleClass('btn-warning').toggleClass('btn-danger'); } else { diff --git a/data/interfaces/default/user.html b/data/interfaces/default/user.html index 0572aa08..c2176a10 100644 --- a/data/interfaces/default/user.html +++ b/data/interfaces/default/user.html @@ -154,7 +154,11 @@ from plexpy import helpers
-   + +   +
@@ -226,6 +230,24 @@ from plexpy import helpers
+ @@ -367,13 +389,36 @@ from plexpy import helpers }); }); - // Delete mode button - $('#row-edit-mode').click(function() { + $('#row-edit-mode').on('click', function() { + $('#delete-message').popover(); + if ($(this).hasClass('active')) { - $('.delete-control').each(function() { + if (history_to_delete.length > 0) { + $('#deleteCount').text(history_to_delete.length); + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-delete', function () { + for (var i = 0; i < history_to_delete.length; i++) { + $.ajax({ + url: 'delete_history_rows', + data: { row_id: history_to_delete[i] }, + async: true, + success: function (data) { + var msg = "User history purged"; + showMsg(msg, false, true, 2000); + } + }); + } + history_table.draw(); + }); + } + + $('.delete-control').each(function () { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).addClass('hidden'); }); + } else { + history_to_delete = []; $('.delete-control').each(function() { $(this).removeClass('hidden'); }); diff --git a/data/interfaces/default/users.html b/data/interfaces/default/users.html index 38ecca5f..df36a858 100644 --- a/data/interfaces/default/users.html +++ b/data/interfaces/default/users.html @@ -97,7 +97,6 @@ users_to_purge.push($(this).attr('data-id')); ul.append('
  • ' + $('div[data-id=' + $(this).attr('data-id') + '] > input').val() + '
  • ') }); - console.log(users_to_purge); if (users_to_purge.length > 0) { $('#users-to-delete').append $('#confirm-modal').modal();