mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-01 05:36:19 +01:00
prevent double click new issue/pull/comment button (#16157)
* prevent double click new issue/pull/comment button when network is not good, these button maybe double clicked, then more than one same issues pulls or comments will be created. this pull request will fix this bug. Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
parent
0eac09e066
commit
672e5a752d
3 changed files with 15 additions and 3 deletions
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
{{template "repo/issue/comment_tab" .}}
|
||||
<div class="text right">
|
||||
<button class="ui green button" tabindex="6">
|
||||
<button class="ui green button loading-button" tabindex="6">
|
||||
{{if .PageIsComparePull}}
|
||||
{{.i18n.Tr "repo.pulls.create"}}
|
||||
{{else}}
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<button class="ui green button" tabindex="5">
|
||||
<button class="ui green button loading-button" tabindex="5">
|
||||
{{.i18n.Tr "repo.issues.create_comment"}}
|
||||
</button>
|
||||
</div>
|
||||
|
@ -172,7 +172,7 @@
|
|||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<button class="ui green button" tabindex="5">
|
||||
<button class="ui green button loading-button" tabindex="5">
|
||||
{{.i18n.Tr "repo.issues.create_comment"}}
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -142,6 +142,18 @@ export function initGlobalCommon() {
|
|||
window.location = href;
|
||||
}
|
||||
});
|
||||
|
||||
// loading-button this logic used to prevent push one form more than one time
|
||||
$(document).on('click', '.button.loading-button', function (e) {
|
||||
const $btn = $(this);
|
||||
|
||||
if ($btn.hasClass('loading')) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
$btn.addClass('loading disabled');
|
||||
});
|
||||
}
|
||||
|
||||
export function initGlobalDropzone() {
|
||||
|
|
Loading…
Reference in a new issue