1
0
Fork 0
forked from forgejo/forgejo

Add modals to Organization and Team remove/leave

Add confirmation modals to Organization and Team remove and leave.

Fix #16215

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Andrew Thornton 2021-07-17 18:37:08 +01:00
parent e83abfc289
commit aa9cd80da7
No known key found for this signature in database
GPG key ID: 3CDE74631F13A748
19 changed files with 157 additions and 40 deletions

View file

@ -2963,13 +2963,19 @@ $(() => {
function showDeletePopup() {
const $this = $(this);
const dataArray = $this.data();
let filter = '';
if ($this.attr('id')) {
filter += `#${$this.attr('id')}`;
if ($this.data('modal-id')) {
filter += `#${$this.data('modal-id')}`;
}
const dialog = $(`.delete.modal${filter}`);
dialog.find('.name').text($this.data('name'));
for (const key of Object.keys(dataArray)) {
if (key && key.startsWith('data')) {
dialog.find(`.${key}`).text(dataArray[key]);
}
}
dialog.modal({
closable: false,
@ -2979,10 +2985,19 @@ function showDeletePopup() {
return;
}
$.post($this.data('url'), {
const postData = {
_csrf: csrf,
id: $this.data('id')
}).done((data) => {
};
for (const key of Object.keys(dataArray)) {
if (key && key.startsWith('data')) {
postData[key.substr(4)] = dataArray[key];
}
if (key === 'id') {
postData['id'] = dataArray['id'];
}
}
$.post($this.data('url'), postData).done((data) => {
window.location.href = data.redirect;
});
}