summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2021-05-27 22:02:04 +0200
committerGitHub <noreply@github.com>2021-05-27 22:02:04 +0200
commitc9480c5f606e1e83f8f9c373052c0ba758bf300b (patch)
treead1897aefa7a8b727c673f9f742dbfe26d05edd9 /web_src
parent6d6a65cf5cc13deddd96bb76b773667d068823d4 (diff)
downloadgitea-c9480c5f606e1e83f8f9c373052c0ba758bf300b.tar.gz
gitea-c9480c5f606e1e83f8f9c373052c0ba758bf300b.zip
Add links to toggle WIP status (#14677)
* Add links to toggle PR WIP status * Allow PR author to toggle WIP status * refactors and restyling, remove links from translations Co-authored-by: Norwin <noerw@users.noreply.github.com> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 5ba2662ea4..9f016ca84a 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -909,6 +909,17 @@ async function initRepository() {
return false;
});
+ // Toggle WIP
+ $('.toggle-wip a, .toggle-wip button').on('click', async (e) => {
+ e.preventDefault();
+ const {title, wipPrefix, updateUrl} = e.currentTarget.closest('.toggle-wip').dataset;
+ await $.post(updateUrl, {
+ _csrf: csrf,
+ title: title?.startsWith(wipPrefix) ? title.substr(wipPrefix.length).trim() : `${wipPrefix.trim()} ${title}`,
+ });
+ reload();
+ });
+
// Issue Comments
initIssueComments();