diff --git a/assets/organisations/js/pages/organisation.js b/assets/organisations/js/pages/organisation.js index ef708dd..782afdd 100644 --- a/assets/organisations/js/pages/organisation.js +++ b/assets/organisations/js/pages/organisation.js @@ -9,7 +9,7 @@ $(document).ready(function() { // Control buttons - bindOrganisationButtons($("#view-organisation"), { delete_redirect: page.delete_redirect, leave_redirect: page.leave_redirect }); + bindOrganisationButtons($("#view-organisation"), { delete_redirect: page.delete_redirect, leave_redirect: page.leave_redirect, allow_redirect: true }); // Table of users in this organisation $("#widget-organisation-members").ufTable({ diff --git a/assets/organisations/js/widgets/organisations.js b/assets/organisations/js/widgets/organisations.js index 0af5e33..b06c003 100644 --- a/assets/organisations/js/widgets/organisations.js +++ b/assets/organisations/js/widgets/organisations.js @@ -5,7 +5,7 @@ /** * Set up the form in a modal after being successfully attached to the body. */ -function attachOrganisationForm() { +function attachOrganisationForm(options) { $("body").on('renderSuccess.ufModal', function(data) { var modal = $(this).ufModal('getModal'); var form = modal.find('.js-form'); @@ -41,7 +41,7 @@ function attachOrganisationForm() { validator: page.validators }).on("submitSuccess.ufForm", function(e, data) { // Reload page on success - if (data.redirect) { + if (data.redirect && options.allow_redirect) { window.location = data.redirect; } else { window.location.reload(); @@ -160,7 +160,7 @@ function bindOrganisationButtons(el, options) { msgTarget: $("#alerts-page") }); - attachOrganisationForm(); + attachOrganisationForm(options); }); // Manage organisation merge button