* 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>
</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}}
</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>
</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>
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() {