unknown_admin 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,7 +32,20 @@ module Admin
|
|
|
32
32
|
protected
|
|
33
33
|
|
|
34
34
|
def collection
|
|
35
|
-
|
|
35
|
+
if params[:rquery].nil?
|
|
36
|
+
if end_of_association_chain.column_names.include? "position"
|
|
37
|
+
params[:rquery] = {s:"position asc"}
|
|
38
|
+
else
|
|
39
|
+
params[:rquery] = {s:"id desc"}
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if params[:q].present? && search_query_field
|
|
44
|
+
@search = end_of_association_chain.where("#{search_query_field} LIKE ?","#{params[:q]}%").search(params[:rquery])
|
|
45
|
+
else
|
|
46
|
+
@search = end_of_association_chain.search(params[:rquery])
|
|
47
|
+
end
|
|
48
|
+
|
|
36
49
|
unless params[:all_pages]
|
|
37
50
|
get_collection_ivar || set_collection_ivar(@search.result.paginate(:page => params[:page], :per_page => per_page))
|
|
38
51
|
else
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% if search_fields.count > 0 %>
|
|
2
2
|
<div class="row">
|
|
3
3
|
<div class="span9 well">
|
|
4
|
-
<%= search_form_for [:admin,@search] do |f| %>
|
|
4
|
+
<%= search_form_for [:admin,@search], :as => :rquery do |f| %>
|
|
5
5
|
<div class="controls">
|
|
6
6
|
<label for="search">Search:
|
|
7
7
|
<div class="input-append">
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unknown_admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-
|
|
13
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: inherited_resources
|