From 36915cdaceb7da7454004d0ea0fef88f262d9e91 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 19 Apr 2024 19:58:32 +0200 Subject: [PATCH] Fix https://github.com/firefly-iii/firefly-iii/issues/8752 --- public/v1/js/ff/list/groups.js | 85 -------------------------------- resources/views/list/groups.twig | 16 +++--- 2 files changed, 8 insertions(+), 93 deletions(-) diff --git a/public/v1/js/ff/list/groups.js b/public/v1/js/ff/list/groups.js index bdb0ad8c94..73834043d7 100644 --- a/public/v1/js/ff/list/groups.js +++ b/public/v1/js/ff/list/groups.js @@ -22,95 +22,10 @@ var count = 0; $(document).ready(function () { updateListButtons(); - addSort(); $('.clone-transaction').click(cloneTransaction); $('.clone-transaction-and-edit').click(cloneTransactionAndEdit); }); -var fixHelper = function (e, tr) { - "use strict"; - var $originals = tr.children(); - var $helper = tr.clone(); - $helper.children().each(function (index) { - // Set helper cell sizes to match the original sizes - $(this).width($originals.eq(index).width()); - }); - return $helper; -}; - -/** - * - */ -function addSort() { - if (typeof $(".table-sortable>tbody").sortable !== "undefined") { - $('.table-sortable>tbody').sortable( - { - items: "tr:not(.unsortable)", - handle: '.object-handle', - stop: sortStop, - start: function (event, ui) { - // Build a placeholder cell that spans all the cells in the row - var cellCount = 0; - $('td, th', ui.helper).each(function () { - // For each TD or TH try and get it's colspan attribute, and add that or 1 to the total - var colspan = 1; - var colspanAttr = $(this).attr('colspan'); - if (colspanAttr > 1) { - colspan = colspanAttr; - } - cellCount += colspan; - }); - - // Add the placeholder UI - note that this is the item's content, so TD rather than TR - ui.placeholder.html(' '); - } - } - ); - } -} - -/** - * - * @param event - * @param ui - * @returns {boolean|undefined} - */ -function sortStop(event, ui) { - "use strict"; - var current = $(ui.item); - var thisDate = current.data('date'); - var originalBG = current.css('backgroundColor'); - - - if (current.prev().data('date') !== thisDate && current.next().data('date') !== thisDate) { - // animate something with color: - current.animate({backgroundColor: "#d9534f"}, 200, function () { - $(this).animate({backgroundColor: originalBG}, 200); - return undefined; - }); - - return false; - } - //return false; - // do update - var list = $('tr[data-date="' + thisDate + '"]'); - var submit = []; - $.each(list, function (i, v) { - var row = $(v); - var id = row.data('id'); - submit.push(id); - }); - - // do extra animation when done? - $.post('transactions/reorder', {items: submit, date: thisDate, _token: token}); - - current.animate({backgroundColor: "#5cb85c"}, 200, function () { - $(this).animate({backgroundColor: originalBG}, 200); - return undefined; - }); - return undefined; -} - /** * diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 00204f61e6..0e01a829a1 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -1,4 +1,4 @@ - +
{% if showCategory or showBudget %} @@ -49,7 +49,7 @@ {% for group in groups %} {% if group.count > 1 %} - +