Allow members to leave organisations
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user