vcfb 1.0.0 → 2.0.2
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/CHANGELOG.md +22 -0
- data/README.md +30 -0
- data/lib/generators/vcfb/components/components_generator.rb +5 -0
- data/lib/generators/vcfb/components/templates/button/component.html.erb +1 -1
- data/lib/generators/vcfb/components/templates/button/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/check_box/component.rb.tt +1 -14
- data/lib/generators/vcfb/components/templates/collection_check_boxes/check_box/component.rb.tt +1 -14
- data/lib/generators/vcfb/components/templates/collection_check_boxes/component.html.erb +1 -1
- data/lib/generators/vcfb/components/templates/collection_check_boxes/component.rb.tt +1 -24
- data/lib/generators/vcfb/components/templates/collection_check_boxes/label/component.html.erb +1 -1
- data/lib/generators/vcfb/components/templates/collection_check_boxes/label/component.rb.tt +1 -14
- data/lib/generators/vcfb/components/templates/collection_radio_buttons/component.html.erb +1 -1
- data/lib/generators/vcfb/components/templates/collection_radio_buttons/component.rb.tt +1 -24
- data/lib/generators/vcfb/components/templates/collection_radio_buttons/label/component.html.erb +1 -1
- data/lib/generators/vcfb/components/templates/collection_radio_buttons/label/component.rb.tt +1 -14
- data/lib/generators/vcfb/components/templates/collection_radio_buttons/radio_button/component.rb.tt +1 -13
- data/lib/generators/vcfb/components/templates/collection_select/component.rb.tt +1 -16
- data/lib/generators/vcfb/components/templates/color_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/component.html.erb +3 -0
- data/lib/generators/vcfb/components/templates/component.rb.tt +4 -0
- data/lib/generators/vcfb/components/templates/date_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/date_select/component.rb.tt +1 -13
- data/lib/generators/vcfb/components/templates/datetime_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/datetime_select/component.rb.tt +1 -13
- data/lib/generators/vcfb/components/templates/email_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/file_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/grouped_collection_select/component.rb.tt +1 -18
- data/lib/generators/vcfb/components/templates/label/component.html.erb +1 -1
- data/lib/generators/vcfb/components/templates/label/component.rb.tt +1 -14
- data/lib/generators/vcfb/components/templates/month_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/number_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/password_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/radio_button/component.rb.tt +1 -13
- data/lib/generators/vcfb/components/templates/range_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/rich_text_area/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/search_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/select/component.rb.tt +1 -18
- data/lib/generators/vcfb/components/templates/submit/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/telephone_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/text_area/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/text_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/time_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/time_select/component.rb.tt +1 -13
- data/lib/generators/vcfb/components/templates/time_zone_select/component.rb.tt +1 -14
- data/lib/generators/vcfb/components/templates/url_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/week_field/component.rb.tt +1 -12
- data/lib/generators/vcfb/components/templates/weekday_select/component.rb.tt +1 -13
- data/lib/generators/vcfb/initializer/initializer_generator.rb +12 -0
- data/lib/generators/vcfb/initializer/template/vcfb.rb.tt +3 -0
- data/lib/vcfb/component/base.rb +40 -0
- data/lib/vcfb/component/base_collection.rb +18 -0
- data/lib/vcfb/component/button.rb +17 -0
- data/lib/vcfb/component/check_box.rb +19 -0
- data/lib/vcfb/component/collection_check_boxes.rb +36 -0
- data/lib/vcfb/component/collection_radio_buttons.rb +36 -0
- data/lib/vcfb/component/collection_select.rb +21 -0
- data/lib/vcfb/component/color_field.rb +17 -0
- data/lib/vcfb/component/date_field.rb +17 -0
- data/lib/vcfb/component/date_select.rb +18 -0
- data/lib/vcfb/component/datetime_field.rb +17 -0
- data/lib/vcfb/component/datetime_select.rb +18 -0
- data/lib/vcfb/component/email_field.rb +17 -0
- data/lib/vcfb/component/file_field.rb +17 -0
- data/lib/vcfb/component/form.rb +41 -0
- data/lib/vcfb/component/grouped_collection_select.rb +23 -0
- data/lib/vcfb/component/label.rb +28 -0
- data/lib/vcfb/component/month_field.rb +17 -0
- data/lib/vcfb/component/number_field.rb +17 -0
- data/lib/vcfb/component/password_field.rb +17 -0
- data/lib/vcfb/component/radio_button.rb +18 -0
- data/lib/vcfb/component/range_field.rb +17 -0
- data/lib/vcfb/component/rich_text_area.rb +17 -0
- data/lib/vcfb/component/search_field.rb +17 -0
- data/lib/vcfb/component/select.rb +23 -0
- data/lib/vcfb/component/submit.rb +17 -0
- data/lib/vcfb/component/telephone_field.rb +17 -0
- data/lib/vcfb/component/text_area.rb +17 -0
- data/lib/vcfb/component/text_field.rb +17 -0
- data/lib/vcfb/component/time_field.rb +17 -0
- data/lib/vcfb/component/time_select.rb +18 -0
- data/lib/vcfb/component/time_zone_select.rb +19 -0
- data/lib/vcfb/component/url_field.rb +17 -0
- data/lib/vcfb/component/week_field.rb +17 -0
- data/lib/vcfb/component/weekday_select.rb +18 -0
- data/lib/vcfb/errors/component_missing.rb +5 -0
- data/lib/vcfb/errors/error.rb +5 -0
- data/lib/vcfb/form_builder.rb +56 -19
- data/lib/vcfb/form_helper.rb +12 -0
- data/lib/vcfb/railtie.rb +7 -0
- data/lib/vcfb/resolver.rb +8 -6
- data/lib/vcfb/tags/collection_check_boxes.rb +2 -2
- data/lib/vcfb/tags/collection_helpers.rb +0 -2
- data/lib/vcfb/tags/collection_radio_buttons.rb +2 -2
- data/lib/vcfb/template.rb +11 -6
- data/lib/vcfb/version.rb +1 -1
- data/lib/vcfb.rb +68 -10
- metadata +44 -5
- data/lib/vcfb/acts_as_form_collection_component.rb +0 -19
- data/lib/vcfb/acts_as_form_component.rb +0 -22
- data/lib/vcfb/acts_as_form_label_component.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37ed059430db4dec9fa83fc4afede218952117e5fcbe393bec25d12b19977e96
|
4
|
+
data.tar.gz: 72786a8449548594a9abd8afa51c1bb3b28a0963cfb1299aad0d8afad766e731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d606a6d676d287b684d28220054b38b1bc84bde12237f90e42e63d4b93e4813139aa30f21c71738ac80c7094894d353a042a59428e08050c4f0ca07045208502
|
7
|
+
data.tar.gz: 80743157ca8269d9323458d21081b03043565d4cab53172aa788abd29bd6acf6d2b54ab9439b6e077fe135ff9e408340e114d4939accb9b3b654f6de4908302d
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,28 @@
|
|
4
4
|
|
5
5
|
-
|
6
6
|
|
7
|
+
## 2.0.2
|
8
|
+
|
9
|
+
- Support for ViewComponent 2.61.0
|
10
|
+
|
11
|
+
## 2.0.1
|
12
|
+
|
13
|
+
- Restore usage of tag options gem if present.
|
14
|
+
|
15
|
+
## 2.0.0
|
16
|
+
|
17
|
+
- Support rendering of the base form tag via component (including slot support
|
18
|
+
for ViewComponent v2.54.0 and above).
|
19
|
+
- Support rendering of slots for button, label, collection checkbox label, and
|
20
|
+
collection radio button label components for ViewComponent v2.54.0 and above.
|
21
|
+
- Extracted form component logic out of generated components to ease future
|
22
|
+
updates.
|
23
|
+
- Added the `vcfb:initializer` generator.
|
24
|
+
|
25
|
+
> **Breaking Change**: If you have previously run the component generator, you
|
26
|
+
> will need to re-run `vcfb:component` and merge the changes into your existing
|
27
|
+
> components.
|
28
|
+
|
7
29
|
## 1.0.0
|
8
30
|
|
9
31
|
- Initial release
|
data/README.md
CHANGED
@@ -64,6 +64,36 @@ a class that inherits from it when using `form_with` or `form_for`.
|
|
64
64
|
<% end %>
|
65
65
|
```
|
66
66
|
|
67
|
+
Generated components support `before_initialize`, `after_initialization`, and `around_initialize` callbacks to minimize the need to override the initlialize methods.
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
module Form
|
71
|
+
module Label
|
72
|
+
after_initialize :set_component_options
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def set_component_options
|
77
|
+
@size = @options.delete(:size) || :default
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
By default, components will inherit from `ApplicationComponent` if it exists or
|
84
|
+
`ViewComponent::Base` if it does not. If you wish to change this behavior,
|
85
|
+
generate an initializer and specify the `parent_component`.
|
86
|
+
|
87
|
+
```sh
|
88
|
+
rails generate vcfb:initializer
|
89
|
+
```
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
VCFB.configure do |config|
|
93
|
+
config.parent_component = "MyCustomBaseComponent"
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
67
97
|
## Development
|
68
98
|
|
69
99
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module Button
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, text = nil, options = {})
|
7
|
-
@form = form
|
8
|
-
@text = text
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {}, &block)
|
13
|
-
button_tag(options, &block)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::Button
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,19 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CheckBox
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {}, checked_value = "1", unchecked_value = "0")
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
@checked_value = checked_value
|
11
|
-
@unchecked_value = unchecked_value
|
12
|
-
end
|
13
|
-
|
14
|
-
def form_element(options = {})
|
15
|
-
check_box(@form.object_name, @method, options, @checked_value, @unchecked_value)
|
16
|
-
end
|
3
|
+
class Component < VCFB::Component::CheckBox
|
17
4
|
end
|
18
5
|
end
|
19
6
|
<% end -%>
|
data/lib/generators/vcfb/components/templates/collection_check_boxes/check_box/component.rb.tt
CHANGED
@@ -1,20 +1,7 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionCheckBoxes
|
3
3
|
module CheckBox
|
4
|
-
class Component <
|
5
|
-
include VCFB::ActsAsFormComponent
|
6
|
-
|
7
|
-
def initialize(form, method, options = {}, checked_value = "1", unchecked_value = "0")
|
8
|
-
@form = form
|
9
|
-
@method = method
|
10
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
11
|
-
@checked_value = checked_value
|
12
|
-
@unchecked_value = unchecked_value
|
13
|
-
end
|
14
|
-
|
15
|
-
def form_element(options = {})
|
16
|
-
check_box(@form.object_name, @method, options, @checked_value, @unchecked_value)
|
17
|
-
end
|
4
|
+
class Component < VCFB::Component::CheckBox
|
18
5
|
end
|
19
6
|
end
|
20
7
|
end
|
@@ -1,29 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionCheckBoxes
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormCollectionComponent
|
5
|
-
|
6
|
-
def initialize(form, method, collection, value_method, text_method, options = {}, html_options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@collection = collection
|
10
|
-
@value_method = value_method
|
11
|
-
@text_method = text_method
|
12
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
13
|
-
@html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
|
14
|
-
end
|
15
|
-
|
16
|
-
def form_element(options = {}, html_options = {}, &block)
|
17
|
-
collection_check_boxes(@form.object_name, @method, @collection, @value_method, @text_method, options, html_options) do |builder|
|
18
|
-
block&.call(builder)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def default_content(builder)
|
25
|
-
builder.check_box + builder.label
|
26
|
-
end
|
3
|
+
class Component < VCFB::Component::CollectionCheckBoxes
|
27
4
|
end
|
28
5
|
end
|
29
6
|
<% end -%>
|
@@ -1,20 +1,7 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionCheckBoxes
|
3
3
|
module Label
|
4
|
-
class Component <
|
5
|
-
include VCFB::ActsAsFormLabelComponent
|
6
|
-
|
7
|
-
def initialize(form, method, text = nil, options = {})
|
8
|
-
@form = form
|
9
|
-
@method = method
|
10
|
-
@text = text
|
11
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
12
|
-
end
|
13
|
-
|
14
|
-
def form_element(options = {}, &block)
|
15
|
-
@text = capture(&block) if block
|
16
|
-
label(@form.object_name, @method, @text, options)
|
17
|
-
end
|
4
|
+
class Component < VCFB::Component::Label
|
18
5
|
end
|
19
6
|
end
|
20
7
|
end
|
@@ -1,29 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionRadioButtons
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormCollectionComponent
|
5
|
-
|
6
|
-
def initialize(form, method, collection, value_method, text_method, options = {}, html_options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@collection = collection
|
10
|
-
@value_method = value_method
|
11
|
-
@text_method = text_method
|
12
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
13
|
-
@html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
|
14
|
-
end
|
15
|
-
|
16
|
-
def form_element(options = {}, html_options = {}, &block)
|
17
|
-
collection_radio_buttons(@form.object_name, @method, @collection, @value_method, @text_method, options, html_options) do |builder|
|
18
|
-
block&.call(builder)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def default_content(builder)
|
25
|
-
builder.radio_button + builder.label
|
26
|
-
end
|
3
|
+
class Component < VCFB::Component::CollectionRadioButtons
|
27
4
|
end
|
28
5
|
end
|
29
6
|
<% end -%>
|
data/lib/generators/vcfb/components/templates/collection_radio_buttons/label/component.rb.tt
CHANGED
@@ -1,20 +1,7 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionRadioButtons
|
3
3
|
module Label
|
4
|
-
class Component <
|
5
|
-
include VCFB::ActsAsFormLabelComponent
|
6
|
-
|
7
|
-
def initialize(form, method, text = nil, options = {})
|
8
|
-
@form = form
|
9
|
-
@method = method
|
10
|
-
@text = text
|
11
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
12
|
-
end
|
13
|
-
|
14
|
-
def form_element(options = {}, &block)
|
15
|
-
@text = capture(&block) if block
|
16
|
-
label(@form.object_name, @method, @text, options)
|
17
|
-
end
|
4
|
+
class Component < VCFB::Component::Label
|
18
5
|
end
|
19
6
|
end
|
20
7
|
end
|
data/lib/generators/vcfb/components/templates/collection_radio_buttons/radio_button/component.rb.tt
CHANGED
@@ -1,19 +1,7 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionRadioButtons
|
3
3
|
module RadioButton
|
4
|
-
class Component <
|
5
|
-
include VCFB::ActsAsFormComponent
|
6
|
-
|
7
|
-
def initialize(form, method, value, options = {})
|
8
|
-
@form = form
|
9
|
-
@method = method
|
10
|
-
@value = value
|
11
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
12
|
-
end
|
13
|
-
|
14
|
-
def form_element(options = {})
|
15
|
-
radio_button(@form.object_name, @method, @value, options)
|
16
|
-
end
|
4
|
+
class Component < VCFB::Component::RadioButton
|
17
5
|
end
|
18
6
|
end
|
19
7
|
end
|
@@ -1,21 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module CollectionSelect
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormCollectionComponent
|
5
|
-
|
6
|
-
def initialize(form, method, collection, value_method, text_method, options = {}, html_options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@collection = collection
|
10
|
-
@value_method = value_method
|
11
|
-
@text_method = text_method
|
12
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
13
|
-
@html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
|
14
|
-
end
|
15
|
-
|
16
|
-
def form_element(options = {}, html_options = {})
|
17
|
-
collection_select(@form.object_name, @method, @collection, @value_method, @text_method, options, html_options)
|
18
|
-
end
|
3
|
+
class Component < VCFB::Component::CollectionSelect
|
19
4
|
end
|
20
5
|
end
|
21
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module ColorField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
color_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::ColorField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module DateField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
date_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::DateField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,18 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module DateSelect
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {}, html_options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
@html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
|
11
|
-
end
|
12
|
-
|
13
|
-
def form_element(options = {}, html_options = {})
|
14
|
-
date_select(@form.object_name, @method, options, html_options)
|
15
|
-
end
|
3
|
+
class Component < VCFB::Component::DateSelect
|
16
4
|
end
|
17
5
|
end
|
18
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module DatetimeField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
datetime_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::DatetimeField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,18 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module DatetimeSelect
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {}, html_options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
@html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
|
11
|
-
end
|
12
|
-
|
13
|
-
def form_element(options = {}, html_options = {})
|
14
|
-
datetime_select(@form.object_name, @method, options, html_options)
|
15
|
-
end
|
3
|
+
class Component < VCFB::Component::DatetimeSelect
|
16
4
|
end
|
17
5
|
end
|
18
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module EmailField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
email_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::EmailField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module FileField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
file_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::FileField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,23 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module GroupedCollectionSelect
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormCollectionComponent
|
5
|
-
|
6
|
-
def initialize(form, method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@collection = collection
|
10
|
-
@group_method = group_method
|
11
|
-
@group_label_method = group_label_method
|
12
|
-
@option_key_method = option_key_method
|
13
|
-
@option_value_method = option_value_method
|
14
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
15
|
-
@html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
|
16
|
-
end
|
17
|
-
|
18
|
-
def form_element(options = {}, html_options = {})
|
19
|
-
grouped_collection_select(@form.object_name, @method, @collection, @group_method, @group_label_method, @option_key_method, @option_value_method, options, html_options)
|
20
|
-
end
|
3
|
+
class Component < VCFB::Component::GroupedCollectionSelect
|
21
4
|
end
|
22
5
|
end
|
23
6
|
<% end -%>
|
@@ -1,19 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module Label
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormLabelComponent
|
5
|
-
|
6
|
-
def initialize(form, method, text = nil, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@text = text
|
10
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
11
|
-
end
|
12
|
-
|
13
|
-
def form_element(options = {}, &block)
|
14
|
-
@text = capture(&block) if block
|
15
|
-
label(@form.object_name, @method, @text, options)
|
16
|
-
end
|
3
|
+
class Component < VCFB::Component::Label
|
17
4
|
end
|
18
5
|
end
|
19
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module MonthField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
month_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::MonthField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module NumberField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
number_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::NumberField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module PasswordField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
password_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::PasswordField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|
@@ -1,18 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module RadioButton
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, value, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@value = value
|
10
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
11
|
-
end
|
12
|
-
|
13
|
-
def form_element(options = {})
|
14
|
-
radio_button(@form.object_name, @method, @value, options)
|
15
|
-
end
|
3
|
+
class Component < VCFB::Component::RadioButton
|
16
4
|
end
|
17
5
|
end
|
18
6
|
<% end -%>
|
@@ -1,17 +1,6 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
module RangeField
|
3
|
-
class Component <
|
4
|
-
include VCFB::ActsAsFormComponent
|
5
|
-
|
6
|
-
def initialize(form, method, options = {})
|
7
|
-
@form = form
|
8
|
-
@method = method
|
9
|
-
@options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def form_element(options = {})
|
13
|
-
range_field(@form.object_name, @method, options)
|
14
|
-
end
|
3
|
+
class Component < VCFB::Component::RangeField
|
15
4
|
end
|
16
5
|
end
|
17
6
|
<% end -%>
|