增加功能<管理员在用户列表中通过用户的“名字”和“邮件地址”来搜索用户>

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-11-04 17:14:18 +08:00
parent 1d76d559dd
commit 2ac9456201
3 changed files with 9 additions and 3 deletions

View File

@ -126,7 +126,7 @@ class AdminController < ApplicationController
@status = params[:status] || 1
scope = User.logged.status(@status)
scope = scope.like(params[:name]) if params[:name].present?
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'base'

View File

@ -17,7 +17,10 @@
<label for='group_id'><%= l(:label_group) %>:</label>
<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
<% end %>
<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 %>
<label for='name'><%= l(:label_user) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %>

View File

@ -17,7 +17,10 @@
<label for='group_id'><%= l(:label_group) %>:</label>
<%= select_tag 'group_id', content_tag('option') + options_from_collection_for_select(@groups, :id, :name, params[:group_id].to_i), :onchange => "this.form.submit(); return false;" %>
<% end %>
<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 %>
<label for='name'><%= l(:label_user) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %><!--Modified by young-->