Remove jQuery .attr from the project page (#30004)

- Switched from jQuery `.attr` to plain javascript `.getAttribute`
- Tested the issue movement between columns, column background color
setting, and column deletion. It all works as before

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 5c91d7920f4aff08768e274269e211e926aa3d36)
This commit is contained in:
Yarden Shoham 2024-03-22 21:56:38 +02:00 committed by Earl Warren
parent 3ea7437fa6
commit c3e9b8b6f9
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -33,7 +33,7 @@ async function moveIssue({item, from, to, oldIndex}) {
const columnSorting = { const columnSorting = {
issues: Array.from(columnCards, (card, i) => ({ issues: Array.from(columnCards, (card, i) => ({
issueID: parseInt($(card).attr('data-issue')), issueID: parseInt(card.getAttribute('data-issue')),
sorting: i, sorting: i,
})), })),
}; };
@ -134,7 +134,7 @@ export function initRepoProject() {
if ($projectColorInput.val()) { if ($projectColorInput.val()) {
setLabelColor($projectHeader, $projectColorInput.val()); setLabelColor($projectHeader, $projectColorInput.val());
} }
$boardColumn.attr('style', `background: ${$projectColorInput.val()}!important`); $boardColumn[0].style = `background: ${$projectColorInput.val()} !important`;
$('.ui.modal').modal('hide'); $('.ui.modal').modal('hide');
} }
}); });
@ -159,9 +159,9 @@ export function initRepoProject() {
}); });
$('.show-delete-project-column-modal').each(function () { $('.show-delete-project-column-modal').each(function () {
const $deleteColumnModal = $(`${$(this).attr('data-modal')}`); const $deleteColumnModal = $(`${this.getAttribute('data-modal')}`);
const $deleteColumnButton = $deleteColumnModal.find('.actions > .ok.button'); const $deleteColumnButton = $deleteColumnModal.find('.actions > .ok.button');
const deleteUrl = $(this).attr('data-url'); const deleteUrl = this.getAttribute('data-url');
$deleteColumnButton.on('click', async (e) => { $deleteColumnButton.on('click', async (e) => {
e.preventDefault(); e.preventDefault();