NIHVIVO-2280: Created js file to handle: filtering in ascendant and descendant order for email, first name, last name, status, and count columns on main account page.
Also created js alert for deletion of accounts, and created custom message depending on how many account user deletes. 1 account message: Are you sure you want to delete this account? More than 1 account message: Are you sure you want to delete these accounts?
This commit is contained in:
parent
0756aac8b0
commit
fea7412d0d
2 changed files with 41 additions and 1 deletions
40
webapp/web/js/account/accountUtils.js
Normal file
40
webapp/web/js/account/accountUtils.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
//Accounts per page
|
||||||
|
//Hide is javascrip is disable
|
||||||
|
$('.accounts-per-page-form input[type="submit"]').hide();
|
||||||
|
|
||||||
|
$('.accounts-per-page').change(function() {
|
||||||
|
$('#account-display').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//Delete accounts
|
||||||
|
//Show is javascript is enable
|
||||||
|
$('input:checkbox[name=delete-all]').show();
|
||||||
|
|
||||||
|
$('input:checkbox[name=delete-all]').click(function(){
|
||||||
|
if ( this.checked ) {
|
||||||
|
// if checked, select all the checkboxes
|
||||||
|
$('input:checkbox[name=deleteAccount]').attr('checked','checked');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// if not checked, deselect all the checkboxes
|
||||||
|
$('input:checkbox[name=deleteAccount]').removeAttr('checked');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input:checkbox[name=deleteAccount]').click(function(){
|
||||||
|
$('input:checkbox[name=delete-all]').removeAttr('checked');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Confirmation alert for account deletion in userAccounts-list.ftl template
|
||||||
|
$('input[name="delete-account"]').click(function(){
|
||||||
|
var countAccount = $('input:checkbox[name=deleteAccount]:checked').length;
|
||||||
|
var answer = confirm( 'Are you sure you want to delete ' + ((countAccount > 1) ? 'these accounts' : 'this account') +'?');
|
||||||
|
return answer;
|
||||||
|
});
|
||||||
|
});
|
|
@ -116,7 +116,7 @@
|
||||||
|
|
||||||
<form method="POST" action="${formUrls.list}" id="account-display" class="customForm" role="">
|
<form method="POST" action="${formUrls.list}" id="account-display" class="customForm" role="">
|
||||||
<section class="accounts">
|
<section class="accounts">
|
||||||
<input type="submit" class="delete-account submit" value="Delete" onClick="changeAction(this.form, '${formUrls.delete}')" />
|
<input type="submit" name="delete-account" class="delete-account submit" value="Delete" onClick="changeAction(this.form, '${formUrls.delete}')" />
|
||||||
<!--
|
<!--
|
||||||
When this is clicked, the checkboxes are noticed and all other fields are ignored.
|
When this is clicked, the checkboxes are noticed and all other fields are ignored.
|
||||||
submit the form (submit action is formUrls.delete)
|
submit the form (submit action is formUrls.delete)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue