2016-12-21 11:30:29 -05:00
|
|
|
/* global merge_request_widget */
|
2016-12-20 11:41:09 -05:00
|
|
|
|
2016-12-21 11:30:29 -05:00
|
|
|
(() => {
|
|
|
|
$(() => {
|
|
|
|
/* TODO: This needs a better home, or should be refactored. It was previously contained
|
|
|
|
* in a script tag in app/views/projects/merge_requests/widget/open/_accept.html.haml,
|
|
|
|
* but Vue chokes on script tags and prevents their execution. So it was moved here
|
|
|
|
* temporarily.
|
|
|
|
* */
|
2016-12-20 11:41:09 -05:00
|
|
|
|
2017-01-21 09:11:28 -05:00
|
|
|
$(document)
|
|
|
|
.off('ajax:send', '.accept-mr-form')
|
|
|
|
.on('ajax:send', '.accept-mr-form', () => {
|
|
|
|
$('.accept-mr-form :input').disable();
|
|
|
|
});
|
2016-12-20 11:41:09 -05:00
|
|
|
|
2017-01-21 09:11:28 -05:00
|
|
|
$(document)
|
2017-02-14 17:08:30 -05:00
|
|
|
.off('click', '.accept-merge-request')
|
|
|
|
.on('click', '.accept-merge-request', () => {
|
|
|
|
$('.js-merge-button, .js-merge-when-pipeline-succeeds-button').html('<i class="fa fa-spinner fa-spin"></i> Merge in progress');
|
2017-01-21 09:11:28 -05:00
|
|
|
});
|
2016-12-21 11:30:29 -05:00
|
|
|
|
2017-01-21 09:11:28 -05:00
|
|
|
$(document)
|
2017-02-14 17:08:30 -05:00
|
|
|
.off('click', '.merge-when-pipeline-succeeds')
|
|
|
|
.on('click', '.merge-when-pipeline-succeeds', () => {
|
2017-02-17 08:56:13 -05:00
|
|
|
$('#merge_when_pipeline_succeeds').val('1');
|
2017-01-21 09:11:28 -05:00
|
|
|
});
|
2016-12-21 11:30:29 -05:00
|
|
|
|
2017-01-21 09:11:28 -05:00
|
|
|
$(document)
|
|
|
|
.off('click', '.js-merge-dropdown a')
|
|
|
|
.on('click', '.js-merge-dropdown a', (e) => {
|
|
|
|
e.preventDefault();
|
2017-01-22 06:39:51 -05:00
|
|
|
$(e.target).closest('form').submit();
|
2017-01-21 09:11:28 -05:00
|
|
|
});
|
|
|
|
if ($('.rebase-in-progress').length) {
|
2016-12-21 11:30:29 -05:00
|
|
|
merge_request_widget.rebaseInProgress();
|
|
|
|
} else if ($('.rebase-mr-form').length) {
|
2017-01-21 09:11:28 -05:00
|
|
|
$(document)
|
|
|
|
.off('ajax:send', '.rebase-mr-form')
|
|
|
|
.on('ajax:send', '.rebase-mr-form', () => {
|
2016-12-21 11:30:29 -05:00
|
|
|
$('.rebase-mr-form :input').disable();
|
|
|
|
});
|
2016-12-20 11:41:09 -05:00
|
|
|
|
2017-01-21 09:11:28 -05:00
|
|
|
$(document)
|
|
|
|
.off('click', '.js-rebase-button')
|
|
|
|
.on('click', '.js-rebase-button', () => {
|
2016-12-21 11:30:29 -05:00
|
|
|
$('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress");
|
|
|
|
});
|
|
|
|
} else {
|
2017-02-03 16:07:52 -05:00
|
|
|
setTimeout(() => merge_request_widget.getMergeStatus(), 200);
|
2016-12-21 11:30:29 -05:00
|
|
|
}
|
2016-12-20 11:41:09 -05:00
|
|
|
});
|
2016-12-21 11:30:29 -05:00
|
|
|
})();
|