diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html index 9e1ec5f6..99969849 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,53 @@ 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'); }); } }); - }); + $(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/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js index 9898cc1b..dcff4514 100644 --- a/data/interfaces/default/js/tables/history_table.js +++ b/data/interfaces/default/js/tables/history_table.js @@ -32,7 +32,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 +98,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 + '
'); } @@ -287,16 +287,9 @@ $('#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); - } - }); - + if ($(this).hasClass('active')) { + $(this).toggleClass('btn-warning').toggleClass('btn-danger'); + } else { + $(this).toggleClass('btn-danger').toggleClass('btn-warning'); + } }); \ 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 b3f54778..5f1e4304 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/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();