From 2ac9456201212d49b85366e602f4d8c8a48e0007 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 4 Nov 2014 17:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD<=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E5=9C=A8=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E9=80=9A=E8=BF=87=E7=94=A8=E6=88=B7=E7=9A=84=E2=80=9C?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E2=80=9D=E5=92=8C=E2=80=9C=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E2=80=9D=E6=9D=A5=E6=90=9C=E7=B4=A2=E7=94=A8?= =?UTF-8?q?=E6=88=B7>=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 2 +- app/views/admin/search.html.erb | 5 ++++- app/views/admin/users.html.erb | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 3326d0b1a..9b1e045e3 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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' diff --git a/app/views/admin/search.html.erb b/app/views/admin/search.html.erb index 5d49d84fa..758c7b32f 100644 --- a/app/views/admin/search.html.erb +++ b/app/views/admin/search.html.erb @@ -17,7 +17,10 @@ <%= 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 %> - + + <%= 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 %> <%= submit_tag l(:label_search), :class => "small", :name => nil %> diff --git a/app/views/admin/users.html.erb b/app/views/admin/users.html.erb index 7bbdf1c3e..12aa95a16 100644 --- a/app/views/admin/users.html.erb +++ b/app/views/admin/users.html.erb @@ -17,7 +17,10 @@ <%= 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 %> - + + <%= 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 %> <%= submit_tag l(:label_search), :class => "small", :name => nil %>