1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-05-11 05:55:29 +00:00

Add option to update pull request by rebase (#16125)

* add option to update pull request by `rebase`

Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
a1012112796
2021-08-31 22:03:45 +08:00
committed by GitHub
parent 2bb32006fd
commit cbf05c3f79
10 changed files with 184 additions and 26 deletions

View File

@ -1267,6 +1267,36 @@ async function initRepository() {
$('.instruct-toggle').show();
});
// Pull Request update button
const $pullUpdateButton = $('.update-button > button');
$pullUpdateButton.on('click', function (e) {
e.preventDefault();
const $this = $(this);
const redirect = $this.data('redirect');
$this.addClass('loading');
$.post($this.data('do'), {
_csrf: csrf
}).done((data) => {
if (data.redirect) {
window.location.href = data.redirect;
} else if (redirect) {
window.location.href = redirect;
} else {
window.location.reload();
}
});
});
$('.update-button > .dropdown').dropdown({
onChange(_text, _value, $choice) {
const $url = $choice.data('do');
if ($url) {
$pullUpdateButton.find('.button-text').text($choice.text());
$pullUpdateButton.data('do', $url);
}
}
});
initReactionSelector();
}