##// END OF EJS Templates
Adds the ability to search for a user on the administration users list....
Jean-Philippe Lang -
r1943:d967507dcb20
parent child
Show More
@@ -33,15 +33,19 class UsersController < ApplicationController
33 33 sort_update
34 34
35 35 @status = params[:status] ? params[:status].to_i : 1
36 conditions = "status <> 0"
37 conditions = ["status=?", @status] unless @status == 0
36 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
37
38 unless params[:name].blank?
39 name = "%#{params[:name].strip.downcase}%"
40 c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ?", name, name, name]
41 end
38 42
39 @user_count = User.count(:conditions => conditions)
43 @user_count = User.count(:conditions => c.conditions)
40 44 @user_pages = Paginator.new self, @user_count,
41 45 per_page_option,
42 46 params['page']
43 47 @users = User.find :all,:order => sort_clause,
44 :conditions => conditions,
48 :conditions => c.conditions,
45 49 :limit => @user_pages.items_per_page,
46 50 :offset => @user_pages.current.offset
47 51
@@ -6,8 +6,11
6 6
7 7 <% form_tag({}, :method => :get) do %>
8 8 <fieldset><legend><%= l(:label_filter_plural) %></legend>
9 <label><%= l(:field_status) %> :</label>
9 <label><%= l(:field_status) %>:</label>
10 10 <%= select_tag 'status', users_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
11 <label><%= l(:label_user) %>:</label>
12 <%= text_field_tag 'name', params[:name], :size => 30 %>
13 <%= submit_tag l(:button_apply), :class => "small", :name => nil %>
11 14 </fieldset>
12 15 <% end %>
13 16 &nbsp;
General Comments 0
You need to be logged in to leave comments. Login now