filter_form 0.4.10 → 0.5.0
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/README.md +4 -2
- data/lib/filter_form/input_options/checkbox/base.rb +5 -3
- data/lib/filter_form/input_options/number/base.rb +17 -0
- data/lib/filter_form/input_options/{string → number}/money.rb +2 -2
- data/lib/filter_form/input_options_builder.rb +7 -3
- data/lib/filter_form/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f955b67ba36ae6e8823487642aa9d04456e817b2
|
|
4
|
+
data.tar.gz: 81bf7f1de14137936ed2b79f92605f368aa50b29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f938fa1e388b890a627e77742390d03cccf0f17522a72e0cbc5b1d8920d652dd9d6babfd9ea4eb8dd1db510f18523c5e2dcc1b5152531b8e34096b1bd17118c1
|
|
7
|
+
data.tar.gz: a613c25d7f73b5f67bb1b7ad03802e004596e5a566f024b27e4d540a3aaceacf71b66c77ce71ae6de401570fea512d2cc9ce42d00330dd45e3d47c7da96230a6
|
data/README.md
CHANGED
|
@@ -50,12 +50,14 @@ In your view file:
|
|
|
50
50
|
--------------- |:------------------------------------------------|:----------------------|:--------------------------|
|
|
51
51
|
`string` | `string` | `cont` | `input[type=text]` |
|
|
52
52
|
`text` | `text` | `cont` | `input[type=text]` |
|
|
53
|
-
`integer` | `integer` | `eq` | `input[type=
|
|
53
|
+
`integer` | `integer` | `eq` | `input[type=number]` |
|
|
54
|
+
`float` | `float` | `eq` | `input[type=number]` |
|
|
55
|
+
`decimal` | `decimal` | `eq` | `input[type=number]` |
|
|
56
|
+
`money` | `money` [monetized](https://github.com/RubyMoney/money-rails) attribute | `eq` | `input[type=number]` |
|
|
54
57
|
`datetime` | `datetime` | `eq` | `input[type=text]` |
|
|
55
58
|
`date` | `date` | `eq` | `input[type=text]` |
|
|
56
59
|
`belongs_to` | `belongs_to` association | `eq` | `select` |
|
|
57
60
|
`collection` | `has_many` or `has_and_belongs_to_many` association | `eq` | `select` |
|
|
58
|
-
`money` | `money` [monetized](https://github.com/RubyMoney/money-rails) attribute | `eq` | `input[type=text]` |
|
|
59
61
|
`boolean` | `boolean` | `true` | `input[type=checkbox]` |
|
|
60
62
|
|
|
61
63
|
### Customization
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module FilterForm
|
|
2
|
+
module InputOptions
|
|
3
|
+
module Number
|
|
4
|
+
class Base < FilterForm::InputOptions::Base
|
|
5
|
+
private
|
|
6
|
+
|
|
7
|
+
def additional_options
|
|
8
|
+
{ as: :integer }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def additional_input_options
|
|
12
|
+
super.merge(value: input_value)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -6,7 +6,9 @@ require 'filter_form/input_options/select/collection'
|
|
|
6
6
|
|
|
7
7
|
require 'filter_form/input_options/string/base'
|
|
8
8
|
require 'filter_form/input_options/string/date'
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
require 'filter_form/input_options/number/base'
|
|
11
|
+
require 'filter_form/input_options/number/money'
|
|
10
12
|
|
|
11
13
|
require 'filter_form/input_options/checkbox/base'
|
|
12
14
|
|
|
@@ -53,12 +55,14 @@ module FilterForm
|
|
|
53
55
|
|
|
54
56
|
def map_type(_type)
|
|
55
57
|
case _type
|
|
56
|
-
when :
|
|
58
|
+
when :text
|
|
57
59
|
'string/base'
|
|
58
60
|
when :datetime, :date
|
|
59
61
|
'string/date'
|
|
62
|
+
when :integer, :float, :decimal
|
|
63
|
+
'number/base'
|
|
60
64
|
when :money
|
|
61
|
-
'
|
|
65
|
+
'number/money'
|
|
62
66
|
when :belongs_to
|
|
63
67
|
'select/belongs_to'
|
|
64
68
|
when :collection
|
data/lib/filter_form/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: filter_form
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evgeny Li
|
|
@@ -112,12 +112,13 @@ files:
|
|
|
112
112
|
- lib/filter_form/form_helper.rb
|
|
113
113
|
- lib/filter_form/input_options/base.rb
|
|
114
114
|
- lib/filter_form/input_options/checkbox/base.rb
|
|
115
|
+
- lib/filter_form/input_options/number/base.rb
|
|
116
|
+
- lib/filter_form/input_options/number/money.rb
|
|
115
117
|
- lib/filter_form/input_options/select/base.rb
|
|
116
118
|
- lib/filter_form/input_options/select/belongs_to.rb
|
|
117
119
|
- lib/filter_form/input_options/select/collection.rb
|
|
118
120
|
- lib/filter_form/input_options/string/base.rb
|
|
119
121
|
- lib/filter_form/input_options/string/date.rb
|
|
120
|
-
- lib/filter_form/input_options/string/money.rb
|
|
121
122
|
- lib/filter_form/input_options_builder.rb
|
|
122
123
|
- lib/filter_form/ransack/search.rb
|
|
123
124
|
- lib/filter_form/simple_form/form_builder.rb
|