aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2021-08-31 22:03:45 +0800
committerGitHub <noreply@github.com>2021-08-31 16:03:45 +0200
commitcbf05c3f795c1eed999dafe8d0757495e07f1ee2 (patch)
treee9b227ef8dd8d836b04bd126806c8a1264b750ee /web_src
parent2bb32006fd560af44426a06f63f83e3c70c3f258 (diff)
downloadgitea-cbf05c3f795c1eed999dafe8d0757495e07f1ee2.tar.gz
gitea-cbf05c3f795c1eed999dafe8d0757495e07f1ee2.zip
Add option to update pull request by `rebase` (#16125)
* add option to update pull request by `rebase` Signed-off-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/index.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 7e4970c3a0..ba025cfade 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -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();
}