diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index ebbc2489..d473e6fc 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -282,6 +282,10 @@ fieldset[disabled] .btn-bright.active { .modal-body i.fa { color: #fff; } +.modal-body td:hover a .fa, +.modal-body a:focus i.fa { + color: #f9aa03; +} .modal-body strong { color: #F9AA03; } @@ -1823,7 +1827,8 @@ a .home-platforms-instance-list-oval:hover, .button-bar { float: right; } -.colvis-button-bar { +.colvis-button-bar, +.refresh-users-button { float: right; } .nav-settings, @@ -2042,6 +2047,7 @@ a .home-platforms-instance-list-oval:hover, } .history-title .popover.right { margin-left: 12px; + z-index: 5; } .history-title .popover.right .popover-content { padding: 5px 8px; diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html index c7960d20..0615ea28 100644 --- a/data/interfaces/default/history.html +++ b/data/interfaces/default/history.html @@ -103,7 +103,7 @@ data: { row_id: history_to_delete[i] }, async: true, success: function (data) { - var msg = "User history purged"; + var msg = "History deleted"; showMsg(msg, false, true, 2000); } }); @@ -113,7 +113,6 @@ } $('.delete-control').each(function () { - $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).addClass('hidden'); $('#row-edit-mode-alert').fadeOut(200); }); @@ -121,6 +120,7 @@ } else { history_to_delete = []; $('.delete-control').each(function() { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).removeClass('hidden'); }); } diff --git a/data/interfaces/default/history_table_modal.html b/data/interfaces/default/history_table_modal.html index cfff340d..152589eb 100644 --- a/data/interfaces/default/history_table_modal.html +++ b/data/interfaces/default/history_table_modal.html @@ -27,7 +27,8 @@ - + % else: diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html index c2cacf2a..04185bf5 100644 --- a/data/interfaces/default/info.html +++ b/data/interfaces/default/info.html @@ -227,8 +227,11 @@ DOCUMENTATION :: END Watch History for ${data['title']}
-   + +
@@ -341,13 +344,38 @@ DOCUMENTATION :: END clearSearchButton('history_table', history_table); - $('#row-edit-mode').click(function() { + $('#row-edit-mode').on('click', function() { + $('#row-edit-mode-alert').fadeIn(200); + 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 = "History deleted"; + showMsg(msg, false, true, 2000); + } + }); + } + history_table.draw(); + }); + } + + $('.delete-control').each(function () { $(this).addClass('hidden'); + $('#row-edit-mode-alert').fadeOut(200); }); + } else { + history_to_delete = []; $('.delete-control').each(function() { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).removeClass('hidden'); }); } @@ -381,13 +409,38 @@ DOCUMENTATION :: END clearSearchButton('history_table', history_table); - $('#row-edit-mode').click(function() { + $('#row-edit-mode').on('click', function() { + $('#row-edit-mode-alert').fadeIn(200); + 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 = "History deleted"; + showMsg(msg, false, true, 2000); + } + }); + } + history_table.draw(); + }); + } + + $('.delete-control').each(function () { $(this).addClass('hidden'); + $('#row-edit-mode-alert').fadeOut(200); }); + } else { + history_to_delete = []; $('.delete-control').each(function() { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).removeClass('hidden'); }); } diff --git a/data/interfaces/default/js/tables/history_table_modal.js b/data/interfaces/default/js/tables/history_table_modal.js index 1c684907..8a0afa22 100644 --- a/data/interfaces/default/js/tables/history_table_modal.js +++ b/data/interfaces/default/js/tables/history_table_modal.js @@ -74,6 +74,19 @@ history_table_modal_options = { { "targets": [3], "data":"player", + "createdCell": function (td, cellData, rowData, row, col) { + if (cellData !== '') { + var transcode_dec = ''; + if (rowData['video_decision'] === 'transcode') { + transcode_dec = ''; + } else if (rowData['video_decision'] === 'copy') { + transcode_dec = ''; + } else if (rowData['video_decision'] === 'direct play' || rowData['video_decision'] === '') { + transcode_dec = ''; + } + $(td).html('
' + transcode_dec + ' ' + cellData + '
'); + } + }, "className": "no-wrap hidden-sm hidden-xs modal-control" }, { @@ -81,14 +94,21 @@ history_table_modal_options = { "data":"full_title", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { - if (rowData['media_type'] === 'movie' || rowData['media_type'] === 'episode') { - var transcode_dec = ''; - if (rowData['video_decision'] === 'transcode') { - transcode_dec = ' '; - } - $(td).html('
' + cellData + '
' + transcode_dec + '
'); + var media_type = ''; + var thumb_popover = ''; + if (rowData['media_type'] === 'movie') { + media_type = ''; + thumb_popover = '' + cellData + ' (' + rowData['year'] + ')' + $(td).html('
' + media_type + ' ' + thumb_popover + '
'); + } else if (rowData['media_type'] === 'episode') { + media_type = ''; + 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') { - $(td).html('
' + cellData + '
'); + media_type = ''; + thumb_popover = '' + cellData + ' (' + rowData['parent_title'] + ')' + $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else { $(td).html('' + cellData + ''); } @@ -100,9 +120,40 @@ history_table_modal_options = { // Jump to top of page // $('html,body').scrollTop(0); $('#ajaxMsg').fadeOut(); + + // Create the tooltips. + $('.transcode-tooltip').tooltip(); + $('.media-type-tooltip').tooltip(); + $('.thumb-tooltip').popover({ + html: true, + trigger: 'hover', + placement: 'right', + content: function () { + return '
'; + } + }); }, "preDrawCallback": function(settings) { var msg = "
 Fetching rows...
"; showMsg(msg, false, false, 0) } -} \ No newline at end of file +} + +$('#history_table').on('click', 'td.modal-control', function () { + var tr = $(this).parents('tr'); + var row = history_table.row(tr); + var rowData = row.data(); + + function showStreamDetails() { + $.ajax({ + url: 'get_stream_data', + data: { row_id: rowData['id'], user: rowData['friendly_name'] }, + cache: false, + async: true, + complete: function (xhr, status) { + $("#info-modal").html(xhr.responseText); + } + }); + } + showStreamDetails(); +}); \ 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 8a5154df..0e9719db 100644 --- a/data/interfaces/default/js/tables/users.js +++ b/data/interfaces/default/js/tables/users.js @@ -1,3 +1,5 @@ +var users_to_purge = []; + users_list_table_options = { "language": { "search": "Search: ", @@ -187,6 +189,11 @@ users_list_table_options = { "preDrawCallback": function(settings) { var msg = "
 Fetching rows...
"; showMsg(msg, false, false, 0) + }, + "rowCallback": function (row, rowData) { + if ($.inArray(rowData['user_id'], users_to_purge) !== -1) { + $(row).find('button[data-id="' + rowData['user_id'] + '"]').toggleClass('btn-warning').toggleClass('btn-danger'); + } } } @@ -271,9 +278,11 @@ $('#users_list_table').on('click', 'td.edit-control > .edit-user-toggles > butto var row = users_list_table.row(tr); var rowData = row.data(); - if ($(this).hasClass('active')) { - $(this).toggleClass('btn-warning').toggleClass('btn-danger'); + var index = $.inArray(rowData['user_id'], users_to_purge); + if (index === -1) { + users_to_purge.push(rowData['user_id']); } else { - $(this).toggleClass('btn-danger').toggleClass('btn-warning'); + users_to_purge.splice(index, 1); } + $(this).toggleClass('btn-warning').toggleClass('btn-danger'); }); \ No newline at end of file diff --git a/data/interfaces/default/user.html b/data/interfaces/default/user.html index c2176a10..cc6b18a4 100644 --- a/data/interfaces/default/user.html +++ b/data/interfaces/default/user.html @@ -154,13 +154,11 @@ from plexpy import helpers
- -   - - + + +
@@ -390,7 +388,7 @@ from plexpy import helpers }); $('#row-edit-mode').on('click', function() { - $('#delete-message').popover(); + $('#row-edit-mode-alert').fadeIn(200); if ($(this).hasClass('active')) { if (history_to_delete.length > 0) { @@ -403,7 +401,7 @@ from plexpy import helpers data: { row_id: history_to_delete[i] }, async: true, success: function (data) { - var msg = "User history purged"; + var msg = "History deleted"; showMsg(msg, false, true, 2000); } }); @@ -413,13 +411,14 @@ from plexpy import helpers } $('.delete-control').each(function () { - $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).addClass('hidden'); + $('#row-edit-mode-alert').fadeOut(200); }); } else { history_to_delete = []; $('.delete-control').each(function() { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).removeClass('hidden'); }); } diff --git a/data/interfaces/default/users.html b/data/interfaces/default/users.html index df36a858..fe35f072 100644 --- a/data/interfaces/default/users.html +++ b/data/interfaces/default/users.html @@ -12,12 +12,11 @@ All Users
- -   - - + +   +
@@ -85,20 +84,19 @@ clearSearchButton('users_list_table', users_list_table); - var users_to_purge = []; $('#row-edit-mode').on('click', function () { - $('#purge-message').popover(); + $('#row-edit-mode-alert').fadeIn(200); + $('#users-to-delete').html(''); if ($(this).hasClass('active')) { - users_to_purge = []; - ul = $('#users-to-delete'); - ul.html(''); - $('.edit-control button.btn-danger').map(function () { - users_to_purge.push($(this).attr('data-id')); - ul.append('
  • ' + $('div[data-id=' + $(this).attr('data-id') + '] > input').val() + '
  • ') - }); if (users_to_purge.length > 0) { - $('#users-to-delete').append + $('.edit-control').each(function () { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); + }); + + for (var i = 0; i < users_to_purge.length; i++) { + $('#users-to-delete').append('
  • ' + $('div[data-id=' + users_to_purge[i] + '] > input').val() + '
  • '); + } $('#confirm-modal').modal(); $('#confirm-modal').one('click', '#confirm-purge', function () { for (var i = 0; i < users_to_purge.length; i++) { @@ -118,35 +116,16 @@ } $('.edit-control').each(function () { - $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).addClass('hidden'); - }); - $('.edit-user-control > .edit-user-name').each(function () { - a = $(this).children('a'); - input = $(this).children('input'); - a.text(input.val()); - a.removeClass('hidden'); - input.addClass('hidden'); + $('#row-edit-mode-alert').fadeOut(200); }); } else { + users_to_purge = []; $('.edit-control').each(function () { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).removeClass('hidden'); }); - $('.edit-user-control > .edit-user-name').each(function () { - $(this).children('a').addClass('hidden'); - $(this).children('input').removeClass('hidden'); - }); - - } - }); - - $(window).resize(function () { - if ($('.popover').popover().is(':visible')) { - var popover = $('.popover'); - popover.addClass("noTransition"); - $('#purge-message').popover('show'); - popover.removeClass("noTransition"); } }); });