Skip to content

Commit 459edfe

Browse files
committed
fix
1 parent fe65658 commit 459edfe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

templates/repo/home_branch_dropdown.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"CurrentRefType" .ctxData.RefFullName.RefType
66
"CurrentRefShortName" .ctxData.RefFullName.ShortName
77
"CurrentTreePath" .ctxData.TreePath
8-
"RefLinkTemplate" "{RepoLink}/src/{RefTypeNameSubURL}/{TreePath}"
8+
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
99
"AllowCreateNewRef" .ctxData.CanCreateBranch
1010
"ShowViewAllRefsEntry" true
1111
"ContainerClasses" .containerClasses

web_src/js/features/common-button.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ function onShowModalClick(e) {
155155
}
156156

157157
export function initGlobalButtons(): void {
158-
initTargetButtons(document as ParentNode);
159-
}
160-
161-
export function initTargetButtons(target: ParentNode): void {
162158
// There are many "cancel button" elements in modal dialogs, Fomantic UI expects they are button-like elements but never submit a form.
163159
// However, Gitea misuses the modal dialog and put the cancel buttons inside forms, so we must prevent the form submission.
164160
// There are a few cancel buttons in non-modal forms, and there are some dynamically created forms (eg: the "Edit Issue Content")
165-
queryElems(target, 'form button.ui.cancel.button', (el) => el.addEventListener('click', (e) => e.preventDefault()));
161+
addDelegatedEventListener(document, 'click', 'form button.ui.cancel.button', (_ /* el */, e) => e.preventDefault());
166162

163+
initTargetButtons(document);
164+
}
165+
166+
export function initTargetButtons(target: ParentNode): void {
167167
queryElems(target, '.show-panel', (el) => el.addEventListener('click', onShowPanelClick));
168168
queryElems(target, '.hide-panel', (el) => el.addEventListener('click', onHidePanelClick));
169169
queryElems(target, '.show-modal', (el) => el.addEventListener('click', onShowModalClick));

0 commit comments

Comments
 (0)