Organisation admins can now promote/demote members/admins

This commit is contained in:
2022-03-01 14:59:56 +00:00
parent 6b7e7cd53b
commit d6f134e1e9
8 changed files with 426 additions and 4 deletions

View File

@@ -12,6 +12,56 @@
function bindMemberButtons(el, options) {
if (!options) options = {};
// Remove user button
el.find('.js-member-promote').click(function(e) {
e.preventDefault();
$("body").ufModal({
sourceUrl: site.uri.public + '/modals/organisations/o/' + $(this).data('slug') + '/members/confirm-promote',
ajaxParams: {
slug: $(this).data('slug'),
user_name: $(this).data('user_name')
},
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
window.location.reload();
});
});
});
// Remove user button
el.find('.js-member-demote').click(function(e) {
e.preventDefault();
$("body").ufModal({
sourceUrl: site.uri.public + '/modals/organisations/o/' + $(this).data('slug') + '/members/confirm-demote',
ajaxParams: {
slug: $(this).data('slug'),
user_name: $(this).data('user_name')
},
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
window.location.reload();
});
});
});
// Remove user button
el.find('.js-member-remove').click(function(e) {
e.preventDefault();