Add event delegation to prevent events from not firing in certain states.
This commit is contained in:
parent
0ef587b674
commit
b97fd7fad2
1 changed files with 28 additions and 17 deletions
|
@ -8,31 +8,42 @@
|
||||||
* temporarily.
|
* temporarily.
|
||||||
* */
|
* */
|
||||||
|
|
||||||
if ($('.accept-mr-form').length) {
|
$(document)
|
||||||
$('.accept-mr-form').on('ajax:send', () => {
|
.off('ajax:send', '.accept-mr-form')
|
||||||
$('.accept-mr-form :input').disable();
|
.on('ajax:send', '.accept-mr-form', () => {
|
||||||
});
|
$('.accept-mr-form :input').disable();
|
||||||
|
});
|
||||||
|
|
||||||
$('.accept_merge_request').on('click', () => {
|
$(document)
|
||||||
$('.js-merge-button').html('<i class="fa fa-spinner fa-spin"></i> Merge in progress');
|
.off('click', '.accept_merge_request')
|
||||||
});
|
.on('click', '.accept_merge_request', () => {
|
||||||
|
$('.js-merge-button').html('<i class="fa fa-spinner fa-spin"></i> Merge in progress');
|
||||||
|
});
|
||||||
|
|
||||||
$('.merge_when_build_succeeds').on('click', () => {
|
$(document)
|
||||||
$('#merge_when_build_succeeds').val('1');
|
.off('click', '.merge_when_build_succeeds')
|
||||||
});
|
.on('click', '.merge_when_build_succeeds', () => {
|
||||||
|
$('#merge_when_build_succeeds').val('1');
|
||||||
|
});
|
||||||
|
|
||||||
$('.js-merge-dropdown a').on('click', (e) => {
|
$(document)
|
||||||
e.preventDefault();
|
.off('click', '.js-merge-dropdown a')
|
||||||
$(this).closest('form').submit();
|
.on('click', '.js-merge-dropdown a', (e) => {
|
||||||
});
|
e.preventDefault();
|
||||||
} else if ($('.rebase-in-progress').length) {
|
$(this).closest('form').submit();
|
||||||
|
});
|
||||||
|
if ($('.rebase-in-progress').length) {
|
||||||
merge_request_widget.rebaseInProgress();
|
merge_request_widget.rebaseInProgress();
|
||||||
} else if ($('.rebase-mr-form').length) {
|
} else if ($('.rebase-mr-form').length) {
|
||||||
$('.rebase-mr-form').on('ajax:send', () => {
|
$(document)
|
||||||
|
.off('ajax:send', '.rebase-mr-form')
|
||||||
|
.on('ajax:send', '.rebase-mr-form', () => {
|
||||||
$('.rebase-mr-form :input').disable();
|
$('.rebase-mr-form :input').disable();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.js-rebase-button').on('click', () => {
|
$(document)
|
||||||
|
.off('click', '.js-rebase-button')
|
||||||
|
.on('click', '.js-rebase-button', () => {
|
||||||
$('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress");
|
$('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue