From d1e46b29d0f7719207113901cd09da4c39e8d5b1 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sun, 28 Jan 2024 22:21:16 +1100 Subject: [PATCH] Sponsorship auto-generate v0.1.39 + columns fix in maintenance --- .github/workflows/update_sponsors.yml | 4 +- front/maintenance.php | 155 +++--------------------- front/php/templates/language/en_us.json | 2 +- update_sponsors.py | 16 ++- 4 files changed, 33 insertions(+), 144 deletions(-) diff --git a/.github/workflows/update_sponsors.yml b/.github/workflows/update_sponsors.yml index 47fb3aef..db36b227 100755 --- a/.github/workflows/update_sponsors.yml +++ b/.github/workflows/update_sponsors.yml @@ -2,7 +2,7 @@ name: Update Sponsors on: schedule: - - cron: '10 11 * * *' # Set your preferred schedule (UTC) + - cron: '25 11 * * *' # Set your preferred schedule (UTC) jobs: update-readme: @@ -15,4 +15,4 @@ jobs: - name: Update Sponsors run: | GH_TOKEN=${{ secrets.GITHUB_TOKEN }} - gh run workflow_dispatch -R $GITHUB_REPOSITORY update_sponsors_table.yml -t $GH_TOKEN + gh run workflow_dispatch -R $GITHUB_REPOSITORY update_sponsors_table.yml diff --git a/front/maintenance.php b/front/maintenance.php index 2ee6004a..0c187e50 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -836,146 +836,29 @@ function initializeSelectedColumns () { // -------------------------------------------------------- //Initialize Select2 Elements and make them sortable -$(function () { - selectEl = $('.select2').select2(); - +$(function () { + var selectEl = $('.select2').select2(); + selectEl.next().children().children().children().sortable({ - containment: 'parent', stop: function (event, ui) { - ui.item.parent().children('[title]').each(function () { - var title = $(this).attr('title'); - var original = $( 'option:contains(' + title + ')', selectEl ).first(); - original.detach(); - selectEl.append(original) - }); - selectEl.change(); - } + containment: 'parent', + update: function () { + var sortedValues = $(this).children().map(function() { + return $(this).attr('title'); + }).get(); + + var sortedOptions = selectEl.find('option').sort(function(a, b) { + return sortedValues.indexOf($(a).text()) - sortedValues.indexOf($(b).text()); + }); + + // Replace all options in selectEl + selectEl.empty().append(sortedOptions); + + // Trigger change event on Select2 + selectEl.trigger('change'); + } }); }); -// $(function () { -// var selectEl = $('.select2').select2(); - -// selectEl.next().children().children().children().sortable({ -// containment: 'parent', -// stop: function (event, ui) { -// ui.item.parent().children('[title]').each(function () { -// var title = $(this).attr('title'); -// var original = $('option:contains(' + title + ')', selectEl).first(); - -// // Clear any previous data associated with the element -// original.removeData(); - -// original.detach(); -// selectEl.append(original); -// }); - -// // Trigger change event on Select2 -// selectEl.trigger('change'); -// } -// }); -// }); - - -// $(function () { -// var selectEl = $('.select2').select2(); - -// selectEl.next().children().children().children().sortable({ -// containment: 'parent', -// stop: function (event, ui) { -// // Remove all options from selectEl -// selectEl.children().remove(); - -// // Rebuild options based on the sorted order -// ui.item.parent().children('[title]').each(function () { -// var title = $(this).attr('title'); -// var original = $('option:contains(' + title + ')', selectEl).first(); - -// original.removeData(); -// selectEl.append(original); -// }); - -// // Trigger change event on Select2 -// selectEl.trigger('change'); -// } -// }); -// }); - -// $(function () { -// var selectEl = $('.select2').select2(); - -// selectEl.next().children().children().children().sortable({ -// containment: 'parent', -// stop: function (event, ui) { -// var sortedOptions = []; - -// // Build an array of sorted option values -// ui.item.parent().children('[title]').each(function () { -// var title = $(this).attr('title'); -// sortedOptions.push(selectEl.find('option:contains(' + title + ')').val()); -// }); - -// // Remove all options from selectEl -// selectEl.empty(); - -// // Rebuild options based on the sorted order -// $.each(sortedOptions, function (index, value) { -// var option = selectEl.find('option[value="' + value + '"]'); -// selectEl.append(option); -// }); - -// // Trigger change event on Select2 -// selectEl.trigger('change'); -// } -// }); -// }); - -// $(function () { -// var selectEl = $('.select2').select2(); - -// selectEl.next().children().children().children().sortable({ -// containment: 'parent', -// stop: function (event, ui) { -// var sortedOptions = ui.item.parent().children('[title]').map(function () { -// var title = $(this).attr('title'); -// return selectEl.find('option:contains(' + title + ')').prop('outerHTML'); -// }).get().join(''); - -// // Replace all options in selectEl -// selectEl.html(sortedOptions); - -// // Trigger change event on Select2 -// selectEl.trigger('change'); -// } -// }); -// }); - -// $(function () { -// var selectEl = $('.select2').select2(); - -// selectEl.next().children().children().children().sortable({ -// containment: 'parent', -// stop: function (event, ui) { -// var sortedOptions = selectEl.find('option').map(function () { -// var title = $(this).text(); -// var isSelected = $(this).is(':selected'); -// var newOption = $('