simple_form_ransack 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/simple_form_ransack_helper.rb +26 -0
- data/lib/simple_form_ransack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aaf4e35c9ce8bb0bc878d9bd73aeba5da18042b
|
4
|
+
data.tar.gz: a566340fd4da98f5708d09250f1afbe669a9b4a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7483ee3d9547a2500df735a6102c5168a1147b6bf5d7163f59adc2f32cdf148cd6dcb583cc20319976849ca7bc2bfbb6b5530a9bd09e6122d2270db4a3a4df0f
|
7
|
+
data.tar.gz: d2381a05775fff59855115a0e2916d7ff59447df685abd91b56e7e880b8bf214f4fff77c4e1f51c36155890a06a62d5c4dd9681f7bd0f71cd03c8adbf74bde3f
|
@@ -24,4 +24,30 @@ module SimpleFormRansackHelper
|
|
24
24
|
yield form_proxy
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
def simple_search_fields_for(ransack, *args)
|
29
|
+
if args.last.is_a?(Hash)
|
30
|
+
opts = args.pop
|
31
|
+
else
|
32
|
+
opts = {}
|
33
|
+
end
|
34
|
+
|
35
|
+
opts[:url] = request.original_fullpath unless opts[:url]
|
36
|
+
opts[:method] = "get" unless opts[:method]
|
37
|
+
args << opts
|
38
|
+
|
39
|
+
model_class = ransack.klass
|
40
|
+
sample_model = model_class.new
|
41
|
+
ransack_params = ransack.instance_variable_get(:@_registered_params)
|
42
|
+
|
43
|
+
simple_fields_for(sample_model, *args) do |form|
|
44
|
+
form_proxy = SimpleFormRansack::FormProxy.new(
|
45
|
+
ransack: ransack,
|
46
|
+
form: form,
|
47
|
+
params: ransack_params
|
48
|
+
)
|
49
|
+
|
50
|
+
yield form_proxy
|
51
|
+
end
|
52
|
+
end
|
27
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|