add pic and js for permission checkbox and filter

This commit is contained in:
Matthew K. Fu JuYuan 2012-04-09 12:43:51 +08:00
parent c7c3af91dd
commit 0eab9ca8fa
2 changed files with 31 additions and 0 deletions

BIN
app/assets/images/check.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,31 @@
// JavaScript Document
// can copy code to any of ur desired javascsript
//extended jquery to search fast.
$.extend($.expr[':'], {
'containsi': function (elem, i, match, array) {
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
$(document).ready(function(){
$("#user_filter").keyup(function(){
if($(this).val()){
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").length
if(totalfoundbyname!=0){
$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().parent().slideUp();
//$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().popover('hide');
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().parent().slideDown();
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().popover('toggle');
}else if(totalfoundbyname==0){
$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").parent().slideUp();
//$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").popover('hide');
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").parent().slideDown();
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").popover('toggle');
}
}else{
$(".checkbox").popover('hide');
$("div.checkblock").slideDown();
}
})
})