beef-admin_area 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.6
1
+ 0.3.7
@@ -5,20 +5,19 @@ class Admin::UsersController < Admin::BaseController
5
5
  # GET /users
6
6
  # GET /users.xml
7
7
  def index
8
+ @criteria = (params[:search] || {})
8
9
  conditions = []
9
10
  condition_params = []
10
11
  query_type = ' AND '
11
12
 
12
- unless params[:search].nil?
13
- params[:search].each do |key,value|
14
- unless value.blank? || !User.new.respond_to?(key)
15
- conditions << "users.#{key.to_s} LIKE ?"
16
- condition_params << "%#{value}%"
17
- end
13
+ @criteria.each do |key,value|
14
+ unless value.blank? || !User.new.respond_to?(key)
15
+ conditions << "users.#{key.to_s} LIKE ?"
16
+ condition_params << "%#{value}%"
18
17
  end
19
-
20
- query_type = ' OR ' if (params[:search][:query_type] || '') == 'any'
21
18
  end
19
+
20
+ query_type = ' OR ' if (@criteria[:query_type] || '') == 'any'
22
21
 
23
22
  @users = User.paginate :page => params[:page], :per_page => 20, :order => sort_order(:default => 'asc'), :conditions => condition_params.unshift(conditions.join(query_type))
24
23
 
@@ -46,18 +46,18 @@
46
46
  <% form_for :search, :html => {:method => :get} do |f| %>
47
47
  <p>
48
48
  <%= f.label :name %><br/>
49
- <%= f.text_field :name, :value => params[:search][:name] %>
49
+ <%= f.text_field :name, :value => (@criteria[:name] || '') %>
50
50
  </p>
51
51
  <p>
52
52
  <%= f.label :email %><br/>
53
- <%= f.text_field :email, :value => params[:search][:email] %>
53
+ <%= f.text_field :email, :value => (@criteria[:email] || '') %>
54
54
  </p>
55
55
  <p>
56
56
  <%= f.submit "Filter", :disable_with => 'Filtering...' %>
57
57
  <%= f.label :query_type_all, "all" %>
58
- <%= f.radio_button :query_type, 'all', :checked => ('checked' if (params[:search][:query_type] || 'all') == 'all'), :title => 'Match ALL criteria above.' %>
58
+ <%= f.radio_button :query_type, 'all', :checked => ('checked' if (@criteria[:query_type] || 'all') == 'all'), :title => 'Match ALL criteria above.' %>
59
59
  <%= f.label :query_type_any, "any" %>
60
- <%= f.radio_button :query_type, 'any', :checked => ('checked' if (params[:search][:query_type] || '') == 'any'), :title => 'Match ANY criteria above.' %>
60
+ <%= f.radio_button :query_type, 'any', :checked => ('checked' if (@criteria[:query_type] || '') == 'any'), :title => 'Match ANY criteria above.' %>
61
61
  </p>
62
62
  <% end -%>
63
63
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beef-admin_area}
8
- s.version = "0.3.6"
8
+ s.version = "0.3.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve England"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-admin_area
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 7
10
+ version: 0.3.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England