filter_form 0.4.10 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b440c472101fe2f6148b6bbd267c8cb26b80a3f
4
- data.tar.gz: 6a2887fd96c81e42e2a7fbf2a2a40373a20b2b7a
3
+ metadata.gz: f955b67ba36ae6e8823487642aa9d04456e817b2
4
+ data.tar.gz: 81bf7f1de14137936ed2b79f92605f368aa50b29
5
5
  SHA512:
6
- metadata.gz: c5d26bfb90ac2d85ba545020d74779225fd98056e93ac0ced2cfac0d95417c6edcaf94f346961a2868feeb029ecccc53d492e1b395013138b05da536ff23b930
7
- data.tar.gz: 824d7d344c077367ca4281fbd458627701889e3b94f58768ea0db9b537c099dcc0cf560e149876f8244e037cf9a437d0a7f56cda39bd9145b1f488c6b5d7c424
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=text]` |
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
@@ -5,9 +5,11 @@ module FilterForm
5
5
  private
6
6
 
7
7
  def additional_options
8
- {
9
- as: :boolean
10
- }
8
+ { as: :boolean }
9
+ end
10
+
11
+ def additional_input_options
12
+ super.merge(checked: !!input_value)
11
13
  end
12
14
  end
13
15
  end
@@ -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
@@ -1,7 +1,7 @@
1
1
  module FilterForm
2
2
  module InputOptions
3
- module String
4
- class Money < FilterForm::InputOptions::String::Base
3
+ module Number
4
+ class Money < FilterForm::InputOptions::Number::Base
5
5
  private
6
6
 
7
7
  def input_value
@@ -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
- require 'filter_form/input_options/string/money'
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 :integer, :text
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
- 'string/money'
65
+ 'number/money'
62
66
  when :belongs_to
63
67
  'select/belongs_to'
64
68
  when :collection
@@ -1,3 +1,3 @@
1
1
  module FilterForm
2
- VERSION = '0.4.10'
2
+ VERSION = '0.5.0'
3
3
  end
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.10
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