diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js new file mode 100644 index 000000000..50f3835fb --- /dev/null +++ b/app/assets/javascripts/inc/search.js @@ -0,0 +1,36 @@ +// 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; + } +}); +var interval,sval; +$(document).ready(function(){ + $("#user_filter").keyup(function(e){ + if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){ + sval = $(this).val(); + $(".checkbox").popover("hide"); + $("div.checkblock").hide(); + clearInterval(interval); + interval = setInterval(waitForSearch,1000); + } + }) +}) +var waitForSearch = function(){ + if(sval){ + var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length + if(totalfoundbyname!=0){ + $("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show(); + }else if(totalfoundbyname==0){ + $("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show(); + } + }else{ + $(".checkbox").popover('hide'); + $("div.checkblock").show(); + } + clearInterval(interval); +} \ No newline at end of file diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index e1013c2f5..09aa79c83 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -1,8 +1,8 @@ class AdBanner - include OrbitCoreLib::ObjectAuthable include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes + include OrbitCoreLib::ObjectAuthable field :title field :transition_msec,type: Integer