Change alert and button color on info and user history tables

This commit is contained in:
Jonathan Wong 2015-08-26 17:56:17 -07:00
parent f2b9984cd6
commit 0f10c21a66
3 changed files with 40 additions and 13 deletions

View file

@ -103,7 +103,7 @@
data: { row_id: history_to_delete[i] }, data: { row_id: history_to_delete[i] },
async: true, async: true,
success: function (data) { success: function (data) {
var msg = "User history purged"; var msg = "History deleted";
showMsg(msg, false, true, 2000); showMsg(msg, false, true, 2000);
} }
}); });

View file

@ -227,8 +227,11 @@ DOCUMENTATION :: END
<span>Watch History for <strong>${data['title']}</strong></span> <span>Watch History for <strong>${data['title']}</strong></span>
</div> </div>
<div class="button-bar"> <div class="button-bar">
<button class="btn btn-danger" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode"><i class="fa fa-trash-o"></i> Delete mode</button>&nbsp
<div class="colvis-button-bar hidden-xs"></div> <div class="colvis-button-bar hidden-xs"></div>
<button class="btn btn-danger btn-edit" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode">
<i class="fa fa-trash-o"></i> Delete mode
</button>
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i>&nbspSelect rows to delete. Data is deleted upon exiting delete mode.</div>
</div> </div>
</div> </div>
<div class="table-card-back"> <div class="table-card-back">
@ -341,12 +344,37 @@ DOCUMENTATION :: END
clearSearchButton('history_table', history_table); 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')) { 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).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger');
$(this).addClass('hidden'); $(this).addClass('hidden');
$('#row-edit-mode-alert').fadeOut(200);
}); });
} else { } else {
history_to_delete = [];
$('.delete-control').each(function() { $('.delete-control').each(function() {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
}); });

View file

@ -154,13 +154,11 @@ from plexpy import helpers
</strong></span> </strong></span>
</div> </div>
<div class="button-bar"> <div class="button-bar">
<span data-toggle="popover" data-placement="left" data-content="Select rows to delete. Data is deleted upon exiting delete mode." id="delete-message"> <div class="colvis-button-bar hidden-xs" id="button-bar-history"></div>
<button class="btn btn-danger" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode"> <button class="btn btn-danger btn-edit" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode">
<i class="fa fa-trash-o"></i> Delete mode <i class="fa fa-trash-o"></i> Delete mode
</button>&nbsp </button>
</span> <div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i>&nbspSelect rows to delete. Data is deleted upon exiting delete mode.</div>
<div class="colvis-button-bar hidden-xs" id="button-bar-history">
</div>
</div> </div>
</div> </div>
<div class="table-card-back"> <div class="table-card-back">
@ -390,7 +388,7 @@ from plexpy import helpers
}); });
$('#row-edit-mode').on('click', function() { $('#row-edit-mode').on('click', function() {
$('#delete-message').popover(); $('#row-edit-mode-alert').fadeIn(200);
if ($(this).hasClass('active')) { if ($(this).hasClass('active')) {
if (history_to_delete.length > 0) { if (history_to_delete.length > 0) {
@ -403,7 +401,7 @@ from plexpy import helpers
data: { row_id: history_to_delete[i] }, data: { row_id: history_to_delete[i] },
async: true, async: true,
success: function (data) { success: function (data) {
var msg = "User history purged"; var msg = "History deleted";
showMsg(msg, false, true, 2000); showMsg(msg, false, true, 2000);
} }
}); });
@ -415,6 +413,7 @@ from plexpy import helpers
$('.delete-control').each(function () { $('.delete-control').each(function () {
$(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger');
$(this).addClass('hidden'); $(this).addClass('hidden');
$('#row-edit-mode-alert').fadeOut(200);
}); });
} else { } else {