diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 9a4548643f..9e6a69f71a 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -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}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index b5f838e9d0..91af5160b6 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -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> diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index dda803ae8d..eb21a4bb93 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -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() {