Merge pull request #13834 from MrPetovan/task/remove-delete-rotator

[frio] Move item deletion rotator to button
This commit is contained in:
Michael Vogel 2024-01-17 18:00:31 +01:00 committed by GitHub
commit 75b37fe376
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 24 deletions

View file

@ -379,7 +379,7 @@ $(function() {
// Allow folks to stop the ajax page updates with the pause/break key // Allow folks to stop the ajax page updates with the pause/break key
$(document).keydown(function(event) { $(document).keydown(function(event) {
// Pause/Break or Ctrl + Space // Pause/Break or Ctrl + Space
if (event.which === 19 || (!event.shiftKey && !event.altKey && event.ctrlKey && event.which === 32)) { if (event.which === 19 || (!event.metaKey && !event.shiftKey && !event.altKey && event.ctrlKey && event.which === 32)) {
event.preventDefault(); event.preventDefault();
if (stopped === false) { if (stopped === false) {
stopped = true; stopped = true;
@ -643,7 +643,7 @@ function liveUpdate(src) {
function updateItem(itemNo) { function updateItem(itemNo) {
force_update = true; force_update = true;
update_item = itemNo; update_item = itemNo;
} }
function imgbright(node) { function imgbright(node) {

View file

@ -145,45 +145,42 @@
}); });
function deleteCheckedItems() { function deleteCheckedItems() {
if(confirm('{{$delitems}}')) { if (confirm('{{$delitems}}')) {
var checkedstr = ''; let checkedstr = '';
var ItemsToDelete = {}; const ItemsToDelete = {};
$("#item-delete-selected").hide(); $('#item-delete-selected').prop('disabled', true);
$('#item-delete-selected-rotator').show(); $('#item-delete-selected i').toggleClass('fa-trash fa-hourglass fa-spin');
$('body').css('cursor', 'wait');
$('.item-select').each( function() { $('.item-select').each(function () {
if($(this).is(':checked')) { if ($(this).is(':checked')) {
if(checkedstr.length != 0) { if (checkedstr.length > 0) {
checkedstr = checkedstr + ',' + $(this).val(); checkedstr = checkedstr + ',' + $(this).val();
var deleteItem = this.closest(".wall-item-container"); } else {
ItemsToDelete[deleteItem.id] = deleteItem;
}
else {
checkedstr = $(this).val(); checkedstr = $(this).val();
} }
// Get the corresponding item container // Get the corresponding item container
var deleteItem = this.closest(".wall-item-container"); const deleteItem = this.closest(".wall-item-container");
ItemsToDelete[deleteItem.id] = deleteItem; ItemsToDelete[deleteItem.id] = deleteItem;
} }
}); });
// Fade the container from the items we want to delete // Fade the container from the items we want to delete
for(var key in ItemsToDelete) { for (const key in ItemsToDelete) {
$(ItemsToDelete[key]).fadeTo('fast', 0.33); $(ItemsToDelete[key]).fadeTo('fast', 0.33);
}; }
$.post('item', { dropitems: checkedstr }, function(data) { $.post('item', {dropitems: checkedstr}, function (data) {
}).done(function() { }).done(function () {
// Loop through the ItemsToDelete Object and remove // Loop through the ItemsToDelete Object and remove
// corresponding item div // corresponding item div
for(var key in ItemsToDelete) { for (const key in ItemsToDelete) {
$(ItemsToDelete[key]).remove(); $(ItemsToDelete[key]).remove();
} }
$('body').css('cursor', 'auto');
$('#item-delete-selected-rotator').hide(); $('#item-delete-selected i').toggleClass('fa-trash fa-hourglass fa-spin')
$('#item-delete-selected').prop('disabled', false).hide();
}); });
} }
} }

View file

@ -20,6 +20,5 @@
<button type="button" id="item-delete-selected" class="btn btn-link" title="{{$dropping}}" onclick="deleteCheckedItems();" data-toggle="tooltip"> <button type="button" id="item-delete-selected" class="btn btn-link" title="{{$dropping}}" onclick="deleteCheckedItems();" data-toggle="tooltip">
<i class="fa fa-trash" aria-hidden="true"></i> <i class="fa fa-trash" aria-hidden="true"></i>
</button> </button>
<img id="item-delete-selected-rotator" class="like-rotator" src="images/rotator.gif" style="display: none;" />
{{/if}} {{/if}}
{{/if}} {{/if}}