vcfb 1.0.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.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +89 -0
  5. data/Rakefile +3 -0
  6. data/lib/generators/vcfb/components/USAGE.md +74 -0
  7. data/lib/generators/vcfb/components/components_generator.rb +172 -0
  8. data/lib/generators/vcfb/components/templates/button/component.html.erb +3 -0
  9. data/lib/generators/vcfb/components/templates/button/component.rb.tt +17 -0
  10. data/lib/generators/vcfb/components/templates/check_box/component.html.erb +1 -0
  11. data/lib/generators/vcfb/components/templates/check_box/component.rb.tt +19 -0
  12. data/lib/generators/vcfb/components/templates/collection_check_boxes/check_box/component.html.erb +1 -0
  13. data/lib/generators/vcfb/components/templates/collection_check_boxes/check_box/component.rb.tt +21 -0
  14. data/lib/generators/vcfb/components/templates/collection_check_boxes/component.html.erb +3 -0
  15. data/lib/generators/vcfb/components/templates/collection_check_boxes/component.rb.tt +29 -0
  16. data/lib/generators/vcfb/components/templates/collection_check_boxes/label/component.html.erb +3 -0
  17. data/lib/generators/vcfb/components/templates/collection_check_boxes/label/component.rb.tt +21 -0
  18. data/lib/generators/vcfb/components/templates/collection_radio_buttons/component.html.erb +3 -0
  19. data/lib/generators/vcfb/components/templates/collection_radio_buttons/component.rb.tt +29 -0
  20. data/lib/generators/vcfb/components/templates/collection_radio_buttons/label/component.html.erb +3 -0
  21. data/lib/generators/vcfb/components/templates/collection_radio_buttons/label/component.rb.tt +21 -0
  22. data/lib/generators/vcfb/components/templates/collection_radio_buttons/radio_button/component.html.erb +1 -0
  23. data/lib/generators/vcfb/components/templates/collection_radio_buttons/radio_button/component.rb.tt +20 -0
  24. data/lib/generators/vcfb/components/templates/collection_select/component.html.erb +1 -0
  25. data/lib/generators/vcfb/components/templates/collection_select/component.rb.tt +21 -0
  26. data/lib/generators/vcfb/components/templates/color_field/component.html.erb +1 -0
  27. data/lib/generators/vcfb/components/templates/color_field/component.rb.tt +17 -0
  28. data/lib/generators/vcfb/components/templates/date_field/component.html.erb +1 -0
  29. data/lib/generators/vcfb/components/templates/date_field/component.rb.tt +17 -0
  30. data/lib/generators/vcfb/components/templates/date_select/component.html.erb +1 -0
  31. data/lib/generators/vcfb/components/templates/date_select/component.rb.tt +18 -0
  32. data/lib/generators/vcfb/components/templates/datetime_field/component.html.erb +1 -0
  33. data/lib/generators/vcfb/components/templates/datetime_field/component.rb.tt +17 -0
  34. data/lib/generators/vcfb/components/templates/datetime_select/component.html.erb +1 -0
  35. data/lib/generators/vcfb/components/templates/datetime_select/component.rb.tt +18 -0
  36. data/lib/generators/vcfb/components/templates/email_field/component.html.erb +1 -0
  37. data/lib/generators/vcfb/components/templates/email_field/component.rb.tt +17 -0
  38. data/lib/generators/vcfb/components/templates/file_field/component.html.erb +1 -0
  39. data/lib/generators/vcfb/components/templates/file_field/component.rb.tt +17 -0
  40. data/lib/generators/vcfb/components/templates/grouped_collection_select/component.html.erb +1 -0
  41. data/lib/generators/vcfb/components/templates/grouped_collection_select/component.rb.tt +23 -0
  42. data/lib/generators/vcfb/components/templates/label/component.html.erb +3 -0
  43. data/lib/generators/vcfb/components/templates/label/component.rb.tt +19 -0
  44. data/lib/generators/vcfb/components/templates/month_field/component.html.erb +1 -0
  45. data/lib/generators/vcfb/components/templates/month_field/component.rb.tt +17 -0
  46. data/lib/generators/vcfb/components/templates/number_field/component.html.erb +1 -0
  47. data/lib/generators/vcfb/components/templates/number_field/component.rb.tt +17 -0
  48. data/lib/generators/vcfb/components/templates/password_field/component.html.erb +1 -0
  49. data/lib/generators/vcfb/components/templates/password_field/component.rb.tt +17 -0
  50. data/lib/generators/vcfb/components/templates/radio_button/component.html.erb +1 -0
  51. data/lib/generators/vcfb/components/templates/radio_button/component.rb.tt +18 -0
  52. data/lib/generators/vcfb/components/templates/range_field/component.html.erb +1 -0
  53. data/lib/generators/vcfb/components/templates/range_field/component.rb.tt +17 -0
  54. data/lib/generators/vcfb/components/templates/rich_text_area/component.html.erb +1 -0
  55. data/lib/generators/vcfb/components/templates/rich_text_area/component.rb.tt +17 -0
  56. data/lib/generators/vcfb/components/templates/search_field/component.html.erb +1 -0
  57. data/lib/generators/vcfb/components/templates/search_field/component.rb.tt +17 -0
  58. data/lib/generators/vcfb/components/templates/select/component.html.erb +1 -0
  59. data/lib/generators/vcfb/components/templates/select/component.rb.tt +23 -0
  60. data/lib/generators/vcfb/components/templates/submit/component.html.erb +1 -0
  61. data/lib/generators/vcfb/components/templates/submit/component.rb.tt +17 -0
  62. data/lib/generators/vcfb/components/templates/telephone_field/component.html.erb +1 -0
  63. data/lib/generators/vcfb/components/templates/telephone_field/component.rb.tt +17 -0
  64. data/lib/generators/vcfb/components/templates/text_area/component.html.erb +1 -0
  65. data/lib/generators/vcfb/components/templates/text_area/component.rb.tt +17 -0
  66. data/lib/generators/vcfb/components/templates/text_field/component.html.erb +1 -0
  67. data/lib/generators/vcfb/components/templates/text_field/component.rb.tt +17 -0
  68. data/lib/generators/vcfb/components/templates/time_field/component.html.erb +1 -0
  69. data/lib/generators/vcfb/components/templates/time_field/component.rb.tt +17 -0
  70. data/lib/generators/vcfb/components/templates/time_select/component.html.erb +1 -0
  71. data/lib/generators/vcfb/components/templates/time_select/component.rb.tt +18 -0
  72. data/lib/generators/vcfb/components/templates/time_zone_select/component.html.erb +1 -0
  73. data/lib/generators/vcfb/components/templates/time_zone_select/component.rb.tt +19 -0
  74. data/lib/generators/vcfb/components/templates/url_field/component.html.erb +1 -0
  75. data/lib/generators/vcfb/components/templates/url_field/component.rb.tt +17 -0
  76. data/lib/generators/vcfb/components/templates/week_field/component.html.erb +1 -0
  77. data/lib/generators/vcfb/components/templates/week_field/component.rb.tt +17 -0
  78. data/lib/generators/vcfb/components/templates/weekday_select/component.html.erb +1 -0
  79. data/lib/generators/vcfb/components/templates/weekday_select/component.rb.tt +18 -0
  80. data/lib/vcfb/action_view_tag_patch.rb +9 -0
  81. data/lib/vcfb/acts_as_form_collection_component.rb +19 -0
  82. data/lib/vcfb/acts_as_form_component.rb +22 -0
  83. data/lib/vcfb/acts_as_form_label_component.rb +21 -0
  84. data/lib/vcfb/form_builder.rb +188 -0
  85. data/lib/vcfb/railtie.rb +6 -0
  86. data/lib/vcfb/resolver.rb +18 -0
  87. data/lib/vcfb/tags/collection_check_boxes.rb +26 -0
  88. data/lib/vcfb/tags/collection_helpers.rb +19 -0
  89. data/lib/vcfb/tags/collection_radio_buttons.rb +25 -0
  90. data/lib/vcfb/template.rb +44 -0
  91. data/lib/vcfb/version.rb +3 -0
  92. data/lib/vcfb.rb +12 -0
  93. metadata +247 -0
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module DateField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,18 @@
1
+ <% module_namespacing do -%>
2
+ module DateSelect
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
16
+ end
17
+ end
18
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module DatetimeField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,18 @@
1
+ <% module_namespacing do -%>
2
+ module DatetimeSelect
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
16
+ end
17
+ end
18
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module EmailField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module FileField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,23 @@
1
+ <% module_namespacing do -%>
2
+ module GroupedCollectionSelect
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
21
+ end
22
+ end
23
+ <% end -%>
@@ -0,0 +1,3 @@
1
+ <%= form_element @options do %>
2
+ <%= content.presence || @text %>
3
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <% module_namespacing do -%>
2
+ module Label
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
17
+ end
18
+ end
19
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module MonthField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module NumberField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module PasswordField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,18 @@
1
+ <% module_namespacing do -%>
2
+ module RadioButton
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
16
+ end
17
+ end
18
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module RangeField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module RichTextArea
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ rich_text_area(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module SearchField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ search_field(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,23 @@
1
+ <% module_namespacing do -%>
2
+ module Select
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
4
+ include VCFB::ActsAsFormComponent
5
+
6
+ def initialize(form, method, choices = nil, options = {}, html_options = {})
7
+ @form = form
8
+ @method = method
9
+ @choices = choices
10
+ @options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
11
+ @html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
12
+ end
13
+
14
+ def before_render
15
+ @choices = content if content.present?
16
+ end
17
+
18
+ def form_element(options = {}, html_options = {})
19
+ select(@form.object_name, @method, @choices, options, html_options)
20
+ end
21
+ end
22
+ end
23
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module Submit
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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 = {})
13
+ submit_tag(@text, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module TelephoneField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ telephone_field(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module TextArea
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ text_area(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module TextField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ text_field(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module TimeField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ time_field(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,18 @@
1
+ <% module_namespacing do -%>
2
+ module TimeSelect
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ time_select(@form.object_name, @method, options, html_options)
15
+ end
16
+ end
17
+ end
18
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,19 @@
1
+ <% module_namespacing do -%>
2
+ module TimeZoneSelect
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
4
+ include VCFB::ActsAsFormComponent
5
+
6
+ def initialize(form, method, priority_zones = nil, options = {}, html_options = {})
7
+ @form = form
8
+ @method = method
9
+ @priority_zones = priority_zones
10
+ @options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(options)" : "options" %>
11
+ @html_options = <%= defined?(TagOptions::Hash) ? "TagOptions::Hash.new(html_options)" : "html_options" %>
12
+ end
13
+
14
+ def form_element(options = {}, html_options = {})
15
+ time_zone_select(@form.object_name, @method, @priority_zones, options, html_options)
16
+ end
17
+ end
18
+ end
19
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module UrlField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ url_field(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options %>
@@ -0,0 +1,17 @@
1
+ <% module_namespacing do -%>
2
+ module WeekField
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ week_field(@form.object_name, @method, options)
14
+ end
15
+ end
16
+ end
17
+ <% end -%>
@@ -0,0 +1 @@
1
+ <%= form_element @options, @html_options %>
@@ -0,0 +1,18 @@
1
+ <% module_namespacing do -%>
2
+ module WeekdaySelect
3
+ class Component < <%= defined?(ApplicationComponent) ? "ApplicationComponent" : "ViewComponent::Base" %>
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
+ weekday_select(@form.object_name, @method, options, html_options)
15
+ end
16
+ end
17
+ end
18
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ module ActionView
2
+ module Helpers
3
+ module Tags
4
+ class Base
5
+ delegate :request, to: :@template_object
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ require "active_support/concern"
2
+
3
+ require "vcfb/acts_as_form_component"
4
+
5
+ module VCFB
6
+ module ActsAsFormCollectionComponent
7
+ extend ActiveSupport::Concern
8
+ include ActsAsFormComponent
9
+
10
+ def content(builder)
11
+ @__vc_content = if @view_context && @__vc_render_in_block
12
+ view_context.capture(builder, &@__vc_render_in_block)
13
+ else
14
+ default_content(builder)
15
+ end
16
+ super()
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ require "active_support/concern"
2
+
3
+ require "vcfb/tags/collection_check_boxes"
4
+ require "vcfb/tags/collection_radio_buttons"
5
+
6
+ module VCFB
7
+ module ActsAsFormComponent
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ delegate :rich_text_area_tag, to: :helpers
12
+ end
13
+
14
+ def collection_check_boxes(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block)
15
+ Tags::CollectionCheckBoxes.new(object, method, self, collection, value_method, text_method, options, html_options).render(&block)
16
+ end
17
+
18
+ def collection_radio_buttons(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block)
19
+ Tags::CollectionRadioButtons.new(object, method, self, collection, value_method, text_method, options, html_options).render(&block)
20
+ end
21
+ end
22
+ end