diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html index 99969849..3f0fd33b 100644 --- a/data/interfaces/default/history.html +++ b/data/interfaces/default/history.html @@ -51,7 +51,7 @@ diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html index 8eba3f9b..4a85a3d4 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,11 +303,38 @@ DOCUMENTATION :: END clearSearchButton('history_table', history_table); - $('#row-edit-mode').click(function() { + var history_to_purge = []; + $('#row-edit-mode').on('click', function() { + $('#delete-message').popover(); + if ($(this).hasClass('active')) { - $('.delete-control').each(function() { + history_to_purge = []; + $('.delete-control button.btn-danger').map(function () { + history_to_purge.push($(this).attr('data-id')); + }); + if (history_to_purge.length > 0) { + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-delete', function () { + for (var i = 0; i < history_to_purge.length; i++) { + $.ajax({ + url: 'delete_history_rows', + data: { row_id: history_to_purge[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 { $('.delete-control').each(function() { $(this).removeClass('hidden'); diff --git a/data/interfaces/default/user.html b/data/interfaces/default/user.html index 4727be64..979b8113 100644 --- a/data/interfaces/default/user.html +++ b/data/interfaces/default/user.html @@ -155,7 +155,11 @@ from plexpy import helpers
-   + +   +
@@ -227,6 +231,24 @@ from plexpy import helpers + @@ -368,12 +390,38 @@ from plexpy import helpers }); }); - // Delete mode button - $('#row-edit-mode').click(function() { + var history_to_purge = []; + $('#row-edit-mode').on('click', function() { + $('#delete-message').popover(); + if ($(this).hasClass('active')) { - $('.delete-control').each(function() { + history_to_purge = []; + $('.delete-control button.btn-danger').map(function () { + history_to_purge.push($(this).attr('data-id')); + }); + if (history_to_purge.length > 0) { + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-delete', function () { + for (var i = 0; i < history_to_purge.length; i++) { + $.ajax({ + url: 'delete_history_rows', + data: { row_id: history_to_purge[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 { $('.delete-control').each(function() { $(this).removeClass('hidden');