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 +1 -1
- data/app/controllers/admin/users_controller.rb +7 -8
- data/app/views/admin/users/index.html.erb +4 -4
- data/beef-admin_area.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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 =>
|
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 =>
|
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 (
|
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 (
|
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
|
|
data/beef-admin_area.gemspec
CHANGED
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:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 7
|
10
|
+
version: 0.3.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steve England
|