修复bug#2725 :用户搜索--默认用户名和姓名一起匹配
This commit is contained in:
parent
a456616212
commit
2e7c6c4afb
|
@ -255,7 +255,9 @@ class UsersService
|
|||
watcher.push(params[:user_id])
|
||||
scope = scope.where("id not in (?)",watcher)
|
||||
end
|
||||
scope = scope.like(params[:name],search_by)
|
||||
#scope = scope.like(params[:name],search_by)
|
||||
scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )",
|
||||
"%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%")
|
||||
end
|
||||
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
|
||||
else
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<td rowspan="2" >
|
||||
<div class="project-search" style="float: right">
|
||||
<!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
|
||||
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();" ) %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();",:style=>'display:none;' ) %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder=>'昵称/姓名/邮箱' %>
|
||||
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
|
||||
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
|
|
|
@ -73,11 +73,13 @@ form #search_by
|
|||
{
|
||||
if($("#search_type").val() == "users")
|
||||
{
|
||||
$("#search_by").show();
|
||||
$("#q").attr('placeholder','昵称/姓名/邮箱');
|
||||
// $("#search_by").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#search_by").hide();
|
||||
$("#q").attr('placeholder',"<%=l('welcome.search.information')%>");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +95,7 @@ form #search_by
|
|||
<%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %>
|
||||
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
|
||||
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
|
||||
<%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right" ) %>
|
||||
<%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right;display:none;" ) %>
|
||||
</div>
|
||||
<%#= hidden_field_tag 'project_type', project_type %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue