Adds the ability to search for a user on the administration users list.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1945 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d1b5bc1e82
commit
d967507dcb
|
@ -33,15 +33,19 @@ class UsersController < ApplicationController
|
||||||
sort_update
|
sort_update
|
||||||
|
|
||||||
@status = params[:status] ? params[:status].to_i : 1
|
@status = params[:status] ? params[:status].to_i : 1
|
||||||
conditions = "status <> 0"
|
c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
|
||||||
conditions = ["status=?", @status] unless @status == 0
|
|
||||||
|
unless params[:name].blank?
|
||||||
|
name = "%#{params[:name].strip.downcase}%"
|
||||||
|
c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ?", name, name, name]
|
||||||
|
end
|
||||||
|
|
||||||
@user_count = User.count(:conditions => conditions)
|
@user_count = User.count(:conditions => c.conditions)
|
||||||
@user_pages = Paginator.new self, @user_count,
|
@user_pages = Paginator.new self, @user_count,
|
||||||
per_page_option,
|
per_page_option,
|
||||||
params['page']
|
params['page']
|
||||||
@users = User.find :all,:order => sort_clause,
|
@users = User.find :all,:order => sort_clause,
|
||||||
:conditions => conditions,
|
:conditions => c.conditions,
|
||||||
:limit => @user_pages.items_per_page,
|
:limit => @user_pages.items_per_page,
|
||||||
:offset => @user_pages.current.offset
|
:offset => @user_pages.current.offset
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
<% form_tag({}, :method => :get) do %>
|
<% form_tag({}, :method => :get) do %>
|
||||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||||
<label><%= l(:field_status) %> :</label>
|
<label><%= l(:field_status) %>:</label>
|
||||||
<%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
<%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||||
|
<label><%= l(:label_user) %>:</label>
|
||||||
|
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||||
|
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue