Added capability for organisation administrators to accept/reject join requests, remove members, edit their details and reset their passwords
This commit is contained in:
104
assets/avsdev/js/widgets/members.js
Normal file
104
assets/avsdev/js/widgets/members.js
Normal file
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Members widget. Sets up dropdowns, modals, etc for a table of members.
|
||||
*
|
||||
* Depends on widgets/users.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Link extra user action buttons in addition to the base ones.
|
||||
* @param {module:jQuery} el jQuery wrapped element to target.
|
||||
* @param {{delete_redirect: string}} options Options used to modify behaviour of button actions.
|
||||
*/
|
||||
function bindMemberButtons(el, options) {
|
||||
if (!options) options = {};
|
||||
|
||||
// Remove user button
|
||||
el.find('.js-member-remove').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$("body").ufModal({
|
||||
sourceUrl: site.uri.public + '/modals/organisations/o/' + $(this).data('slug') + '/members/confirm-remove',
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Accept member button
|
||||
el.find('.js-member-accept').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$("body").ufModal({
|
||||
sourceUrl: site.uri.public + '/modals/organisations/o/' + $(this).data('slug') + '/members/confirm-accept',
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Reject user button
|
||||
el.find('.js-member-reject').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$("body").ufModal({
|
||||
sourceUrl: site.uri.public + '/modals/organisations/o/' + $(this).data('slug') + '/members/confirm-reject',
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// function bindMemberCreationButton(el) {
|
||||
// // Link create button
|
||||
// el.find('.js-member-create').click(function(e) {
|
||||
// e.preventDefault();
|
||||
|
||||
// $("body").ufModal({
|
||||
// sourceUrl: site.uri.public + "/modals/users/create",
|
||||
// msgTarget: $("#alerts-page")
|
||||
// });
|
||||
|
||||
// attachUserForm();
|
||||
// });
|
||||
// };
|
||||
Reference in New Issue
Block a user