Allow members to leave organisations

This commit is contained in:
2022-02-09 12:34:30 +00:00
parent 00128aff5d
commit 711968df08
9 changed files with 189 additions and 5 deletions

View File

@@ -133,6 +133,31 @@ function bindOrganisationButtons(el, options) {
});
});
// Leave organisation button
el.find('.js-organisation-leave').click(function(e) {
e.preventDefault();
$("body").ufModal({
sourceUrl: site.uri.public + "/modals/organisations/o/" + page.organisation_slug + "/members/confirm-leave",
ajaxParams: {
slug: $(this).data('slug')
},
msgTarget: $("#alerts-page")
});
$("body").on('renderSuccess.ufModal', function() {
var modal = $(this).ufModal('getModal');
var form = modal.find('.js-form');
form.ufForm()
.on("submitSuccess.ufForm", function() {
// Navigate or reload page on success
if (options.leave_redirect) window.location.href = options.leave_redirect;
else window.location.reload();
});
});
});
// Delete organisation button
el.find('.js-organisation-delete').click(function(e) {
e.preventDefault();