修改搜索用户报错

This commit is contained in:
sw 2014-11-25 11:29:09 +08:00
parent 89e5eda397
commit fef005d2d3
2 changed files with 5 additions and 4 deletions

View File

@ -376,12 +376,13 @@ class UsersController < ApplicationController
"show_changesets" => true
}
scope = User.logged.status(@status)
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present?
@search_by = params[:search_by] ? params[:search_by][:id] : 0
scope = scope.like(params[:name],@search_by) if params[:name].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'users_base'
@offset ||= @user_pages.reverse_offset
unless @offset == 0
unless @offset == 0
@users = scope.offset(@offset).limit(@limit).all.reverse
else
limit = @user_count % @limit

View File

@ -20,8 +20,8 @@
</td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<label for="user_browse_label"><%= l(:label_user_search_type) %></label>
<%= select "search_by", "id",
<!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
<%#= select "search_by", "id",
{ l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
:size => 20 %>
<%= text_field_tag 'name', params[:name], :size => 30 %>