aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/index.js')
-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();
}