summaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2024-03-31 01:14:57 +0300
committerGitHub <noreply@github.com>2024-03-30 22:14:57 +0000
commit72a5d3faa8b65042a4fc7525d511d8942a47dafe (patch)
tree4c661c10804bc777636911eacdd940746eddf10d /web_src/js
parent6aeff21b76fcbb10d5ce9009ed4243c14633d899 (diff)
downloadgitea-72a5d3faa8b65042a4fc7525d511d8942a47dafe.tar.gz
gitea-72a5d3faa8b65042a4fc7525d511d8942a47dafe.zip
Remove jQuery class from the issue author dropdown (#30188)
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the issue author dropdown functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/features/repo-issue-list.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js
index 4582f87425..ccd13bbcf5 100644
--- a/web_src/js/features/repo-issue-list.js
+++ b/web_src/js/features/repo-issue-list.js
@@ -6,6 +6,7 @@ import {confirmModal} from './comp/ConfirmModal.js';
import {showErrorToast} from '../modules/toast.js';
import {createSortable} from '../modules/sortable.js';
import {DELETE, POST} from '../modules/fetch.js';
+import {parseDom} from '../utils.js';
function initRepoIssueListCheckboxes() {
const issueSelectAll = document.querySelector('.issue-checkbox-all');
@@ -129,22 +130,27 @@ function initRepoIssueListAuthorDropdown() {
const dropdownTemplates = $searchDropdown.dropdown('setting', 'templates');
$searchDropdown.dropdown('internal', 'setup', dropdownSetup);
dropdownSetup.menu = function (values) {
- const $menu = $searchDropdown.find('> .menu');
- $menu.find('> .dynamic-item').remove(); // remove old dynamic items
+ const menu = $searchDropdown.find('> .menu')[0];
+ // remove old dynamic items
+ for (const el of menu.querySelectorAll(':scope > .dynamic-item')) {
+ el.remove();
+ }
const newMenuHtml = dropdownTemplates.menu(values, $searchDropdown.dropdown('setting', 'fields'), true /* html */, $searchDropdown.dropdown('setting', 'className'));
if (newMenuHtml) {
- const $newMenuItems = $(newMenuHtml);
- $newMenuItems.addClass('dynamic-item');
+ const newMenuItems = parseDom(newMenuHtml, 'text/html').querySelectorAll('body > div');
+ for (const newMenuItem of newMenuItems) {
+ newMenuItem.classList.add('dynamic-item');
+ }
const div = document.createElement('div');
div.classList.add('divider', 'dynamic-item');
- $menu[0].append(div, ...$newMenuItems);
+ menu.append(div, ...newMenuItems);
}
$searchDropdown.dropdown('refresh');
// defer our selection to the next tick, because dropdown will set the selection item after this `menu` function
setTimeout(() => {
- $menu.find('.item.active, .item.selected').removeClass('active selected');
- $menu.find(`.item[data-value="${selectedUserId}"]`).addClass('selected');
+ menu.querySelector('.item.active, .item.selected')?.classList.remove('active', 'selected');
+ menu.querySelector(`.item[data-value="${selectedUserId}"]`)?.classList.add('selected');
}, 0);
};
}