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:
parent
e83abfc289
commit
aa9cd80da7
19 changed files with 157 additions and 40 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue