From 2f279c53ff777991802235e525e2d7077f4ffb35 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 19 Apr 2012 11:50:54 +0800 Subject: [PATCH] Apply patch from ldap --- app/assets/javascripts/inc/search.js | 39 +++++++++++++++------------- app/views/layouts/_side_bar.html.erb | 16 ++++++------ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js index 979b5621..70507fc6 100644 --- a/app/assets/javascripts/inc/search.js +++ b/app/assets/javascripts/inc/search.js @@ -8,24 +8,27 @@ $.extend($.expr[':'], { return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; } }); +var interval,sval; $(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(); - } + sval = $(this).val(); + $(".checkbox").popover("hide"); + $("div.checkblock").hide(); + clearInterval(interval); + interval = setInterval(waitForSearch,1000); }) -}) \ No newline at end of file +}) +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/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index f74f24f6..38380984 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -5,10 +5,10 @@ <%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks')) do -%> - <%= content_tag :li, link_to(t('admin.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> - <%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> - <%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> - <%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> + <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> + <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> + <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %> <% end -%> @@ -41,10 +41,10 @@ <%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%> - <%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> - <%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %> - <%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> - <%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('admin.announcement.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> + <%= content_tag :li, link_to(t('admin.announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %> + <%= content_tag :li, link_to(t('admin.announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> + <%= content_tag :li, link_to(t('admin.announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %> <% end -%> <% end -%>