filter_form 0.4.5 → 0.4.6
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.
- checksums.yaml +4 -4
- data/lib/filter_form/input_options/base.rb +9 -2
- data/lib/filter_form/input_options/select/belongs_to.rb +1 -9
- data/lib/filter_form/input_options/select/collection.rb +1 -9
- data/lib/filter_form/input_options/string/money.rb +2 -2
- data/lib/filter_form/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: 99ecd45deccc48a229e6d8faff117fb5a87b22f4
|
4
|
+
data.tar.gz: 9f70f5ff1d832d6c5169e8a639e1250550ccf397
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 115cdd02a42840913def1a8f18dd274678cd7bef569b6a85b2d41ee2b93cbd686e30d773cfc71e78857e5ae1bb2eb98313ce5a0ac677771fac9b8c1a74368b88
|
7
|
+
data.tar.gz: f15b1c850a2d4e467d77546ce5b9ddd14d969959b37d4aa8d7ac158894db7c05fe136f0dfc517a3432a5cb7223363d7bd96069359dee811e5129c0f078c41063
|
@@ -52,7 +52,7 @@ module FilterForm
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def input_name
|
55
|
-
"q[#{
|
55
|
+
"q[#{ input_attribute_name }_#{ predicate }]"
|
56
56
|
end
|
57
57
|
|
58
58
|
def input_value
|
@@ -60,7 +60,14 @@ module FilterForm
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def object_condition
|
63
|
-
object.base.conditions.select
|
63
|
+
object.base.conditions.select do |condition|
|
64
|
+
condition.a.first.name == input_attribute_name.to_s &&
|
65
|
+
condition.predicate.name == predicate.to_s
|
66
|
+
end.first
|
67
|
+
end
|
68
|
+
|
69
|
+
def input_attribute_name
|
70
|
+
attribute_name
|
64
71
|
end
|
65
72
|
end
|
66
73
|
end
|
@@ -4,19 +4,11 @@ module FilterForm
|
|
4
4
|
class BelongsTo < FilterForm::InputOptions::Select::Base
|
5
5
|
private
|
6
6
|
|
7
|
-
def object_condition
|
8
|
-
object.base.conditions.select { |c| c.a.first.name == custom_attribute_name }.first
|
9
|
-
end
|
10
|
-
|
11
7
|
def collection
|
12
8
|
options[:collection] || attribute_name.to_s.camelize.constantize.all
|
13
9
|
end
|
14
10
|
|
15
|
-
def
|
16
|
-
"q[#{ custom_attribute_name }_#{ predicate }]"
|
17
|
-
end
|
18
|
-
|
19
|
-
def custom_attribute_name
|
11
|
+
def input_attribute_name
|
20
12
|
"#{ attribute_name }_id"
|
21
13
|
end
|
22
14
|
end
|
@@ -4,19 +4,11 @@ module FilterForm
|
|
4
4
|
class Collection < FilterForm::InputOptions::Select::Base
|
5
5
|
private
|
6
6
|
|
7
|
-
def object_condition
|
8
|
-
object.base.conditions.select { |c| c.a.first.name == custom_attribute_name }.first
|
9
|
-
end
|
10
|
-
|
11
7
|
def collection
|
12
8
|
options[:collection] || attribute_name.to_s.camelize.singularize.constantize.all
|
13
9
|
end
|
14
10
|
|
15
|
-
def
|
16
|
-
"q[#{ custom_attribute_name }_#{ predicate }]"
|
17
|
-
end
|
18
|
-
|
19
|
-
def custom_attribute_name
|
11
|
+
def input_attribute_name
|
20
12
|
"#{ attribute_name }_id"
|
21
13
|
end
|
22
14
|
end
|
data/lib/filter_form/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filter_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeny Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_form
|