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>
This commit is contained in:
Jimmy Praet 2021-05-27 22:02:04 +02:00 committed by GitHub
parent 6d6a65cf5c
commit c9480c5f60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 25 deletions

View file

@ -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();