Skip to content

Commit 8d71b73

Browse files
author
jackHay22
committed
fix lints
1 parent 12e3e0b commit 8d71b73

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

web_src/js/features/repo-release.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {hideElem, showElem, type DOMEvent} from '../utils/dom.ts';
23
import {fomanticQuery} from '../modules/fomantic/base.ts';
34

@@ -23,7 +24,7 @@ function initTagNameEditor() {
2324
if (!el) return;
2425

2526
const tagWarning = document.querySelector('#tag-warning');
26-
const tagWarningDetailLinks = Array.from(document.getElementsByClassName('tag-warning-detail'));
27+
const tagWarningDetailLinks = Array.from(document.querySelectorAll('.tag-warning-detail'));
2728
const existingTags = JSON.parse(el.getAttribute('data-existing-tags'));
2829

2930
const defaultTagHelperText = el.getAttribute('data-tag-helper');
@@ -38,23 +39,24 @@ function initTagNameEditor() {
3839
$('.tag-confirm').on('click', (event) => {
3940
if (requiresConfirmation) {
4041
event.preventDefault();
41-
if ($(event.target).hasClass('tag-draft')) {
42+
const form = event.target.closest('form');
43+
if (event.target.classList.contains('tag-draft')) {
4244
fomanticQuery(tagConfirmDraftModal).modal({
4345
onApprove() {
4446
// need to add hidden input with draft form value
4547
// (triggering form submission doesn't include the button data)
46-
$('<input>').attr({
47-
type: 'hidden',
48-
name: 'draft',
49-
value: '1'
50-
}).appendTo(event.target.form);
51-
$(event.target.form).trigger('submit');
48+
const input = document.createElement('input');
49+
input.type = 'hidden';
50+
input.name = 'draft';
51+
input.value = '1';
52+
form.append(input);
53+
$(form).trigger('submit');
5254
},
5355
}).modal('show');
5456
} else {
5557
fomanticQuery(tagConfirmModal).modal({
5658
onApprove() {
57-
$(event.target.form).trigger('submit');
59+
$(form).trigger('submit');
5860
},
5961
}).modal('show');
6062
}
@@ -71,8 +73,9 @@ function initTagNameEditor() {
7173
tagHelper.textContent = existingTagHelperText;
7274
showElem('#tag-warning');
7375
for (const detail of tagWarningDetailLinks) {
74-
detail.href = `${tagURLStub}/${existingTags[value]}`;
75-
detail.textContent = existingTags[value].substring(0, 10);
76+
const anchor = detail as HTMLAnchorElement;
77+
anchor.href = `${tagURLStub}/${existingTags[value]}`;
78+
anchor.textContent = existingTags[value].substring(0, 10);
7679
}
7780
requiresConfirmation = true;
7881
} else {

0 commit comments

Comments
 (0)