orbit-basic/app/assets/javascripts/lib/member/registration_approval.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

jQuery(document).ready(function($) {
var selectAll = $( "#select_all_registration" ),
checkboxes = $( "input.select-this" ),
selectedBtns = $( "a.selected-actions" );
selectAll.bind(clickEvent,function(){
if( $( this ).is( ":checked" ) ){
checkboxes.prop( "checked", true );
selectedBtns.removeClass('hide');
}else{
checkboxes.prop( "checked", false );
selectedBtns.addClass('hide');
}
});
checkboxes.bind(clickEvent,function(){
var checkedCheckboxes = $( "input.select-this:checked" );
if( checkboxes.length == checkedCheckboxes.length ){
selectAll.prop( "checked", true );
}else{
selectAll.prop( "checked", false );
}
(checkedCheckboxes.length > 0 ? selectedBtns.removeClass('hide') : selectedBtns.addClass('hide'));
});
selectedBtns.bind(clickEvent,function(){
if( confirm("Are you sure?") ){
var userids = [],
_this = $( this ),
checkedCheckboxes = $( "input.select-this:checked" );
checkedCheckboxes.each(function(){
userids.push( $( this ).val() );
})
$.ajax({
url : _this.attr("href"),
type : "post",
dataType : "json",
data : {"userids" : userids},
success : function(data){
if( data.success == true){
window.location.href = data.url;
}
}
})
}
return false;
})
});