view_component-form 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +16 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +170 -0
  5. data/app/components/view_component/form/base_component.rb +53 -0
  6. data/app/components/view_component/form/button_component.rb +19 -0
  7. data/app/components/view_component/form/check_box_component.rb +27 -0
  8. data/app/components/view_component/form/collection_check_boxes_component.rb +50 -0
  9. data/app/components/view_component/form/collection_radio_buttons_component.rb +50 -0
  10. data/app/components/view_component/form/collection_select_component.rb +49 -0
  11. data/app/components/view_component/form/color_field_component.rb +9 -0
  12. data/app/components/view_component/form/date_field_component.rb +9 -0
  13. data/app/components/view_component/form/date_select_component.rb +34 -0
  14. data/app/components/view_component/form/datetime_field_component.rb +9 -0
  15. data/app/components/view_component/form/datetime_local_field_component.rb +9 -0
  16. data/app/components/view_component/form/datetime_select_component.rb +34 -0
  17. data/app/components/view_component/form/email_field_component.rb +9 -0
  18. data/app/components/view_component/form/field_component.rb +65 -0
  19. data/app/components/view_component/form/file_field_component.rb +9 -0
  20. data/app/components/view_component/form/grouped_collection_select_component.rb +57 -0
  21. data/app/components/view_component/form/label_component.rb +42 -0
  22. data/app/components/view_component/form/month_field_component.rb +9 -0
  23. data/app/components/view_component/form/number_field_component.rb +9 -0
  24. data/app/components/view_component/form/password_field_component.rb +9 -0
  25. data/app/components/view_component/form/radio_button_component.rb +27 -0
  26. data/app/components/view_component/form/range_field_component.rb +9 -0
  27. data/app/components/view_component/form/rich_text_area_component.rb +9 -0
  28. data/app/components/view_component/form/search_field_component.rb +9 -0
  29. data/app/components/view_component/form/select_component.rb +37 -0
  30. data/app/components/view_component/form/submit_component.rb +19 -0
  31. data/app/components/view_component/form/telephone_field_component.rb +9 -0
  32. data/app/components/view_component/form/text_area_component.rb +9 -0
  33. data/app/components/view_component/form/text_field_component.rb +9 -0
  34. data/app/components/view_component/form/time_field_component.rb +9 -0
  35. data/app/components/view_component/form/time_select_component.rb +34 -0
  36. data/app/components/view_component/form/time_zone_select_component.rb +36 -0
  37. data/app/components/view_component/form/url_field_component.rb +9 -0
  38. data/app/components/view_component/form/week_field_component.rb +9 -0
  39. data/lib/generators/vcf/builder/builder_generator.rb +32 -0
  40. data/lib/generators/vcf/builder/templates/builder.rb.erb +4 -0
  41. data/lib/view_component/form/builder.rb +212 -0
  42. data/lib/view_component/form/class_names_helper.rb +37 -0
  43. data/lib/view_component/form/engine.rb +15 -0
  44. data/lib/view_component/form/test_helpers.rb +29 -0
  45. data/lib/view_component/form/version.rb +7 -0
  46. data/lib/view_component/form.rb +5 -0
  47. metadata +152 -0
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "action_controller"
4
+ require "action_controller/test_case"
5
+ require "action_view"
6
+
7
+ module ViewComponent
8
+ module Form
9
+ module TestHelpers
10
+ def form_with(object, options = {})
11
+ ViewComponent::Form::Builder.new(object_name, object, template, options)
12
+ end
13
+
14
+ def object_name
15
+ :user
16
+ end
17
+
18
+ def template
19
+ lookup_context = ActionView::LookupContext.new(ActionController::Base.view_paths)
20
+
21
+ if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("6.1")
22
+ ActionView::Base.new(lookup_context, {}, ApplicationController.new)
23
+ else
24
+ ActionView::Base.new(lookup_context, {})
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ViewComponent
4
+ module Form
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "form/version"
4
+ require_relative "form/engine"
5
+ require_relative "form/builder"
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: view_component-form
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pantographe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-09-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionview
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 6.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: activesupport
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 6.0.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '7.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 6.0.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '7.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: view_component
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.34.0
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 2.34.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '3.0'
73
+ description: Rails FormBuilder for ViewComponent
74
+ email:
75
+ - oss@pantographe.studio
76
+ executables: []
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - CHANGELOG.md
81
+ - LICENSE.txt
82
+ - README.md
83
+ - app/components/view_component/form/base_component.rb
84
+ - app/components/view_component/form/button_component.rb
85
+ - app/components/view_component/form/check_box_component.rb
86
+ - app/components/view_component/form/collection_check_boxes_component.rb
87
+ - app/components/view_component/form/collection_radio_buttons_component.rb
88
+ - app/components/view_component/form/collection_select_component.rb
89
+ - app/components/view_component/form/color_field_component.rb
90
+ - app/components/view_component/form/date_field_component.rb
91
+ - app/components/view_component/form/date_select_component.rb
92
+ - app/components/view_component/form/datetime_field_component.rb
93
+ - app/components/view_component/form/datetime_local_field_component.rb
94
+ - app/components/view_component/form/datetime_select_component.rb
95
+ - app/components/view_component/form/email_field_component.rb
96
+ - app/components/view_component/form/field_component.rb
97
+ - app/components/view_component/form/file_field_component.rb
98
+ - app/components/view_component/form/grouped_collection_select_component.rb
99
+ - app/components/view_component/form/label_component.rb
100
+ - app/components/view_component/form/month_field_component.rb
101
+ - app/components/view_component/form/number_field_component.rb
102
+ - app/components/view_component/form/password_field_component.rb
103
+ - app/components/view_component/form/radio_button_component.rb
104
+ - app/components/view_component/form/range_field_component.rb
105
+ - app/components/view_component/form/rich_text_area_component.rb
106
+ - app/components/view_component/form/search_field_component.rb
107
+ - app/components/view_component/form/select_component.rb
108
+ - app/components/view_component/form/submit_component.rb
109
+ - app/components/view_component/form/telephone_field_component.rb
110
+ - app/components/view_component/form/text_area_component.rb
111
+ - app/components/view_component/form/text_field_component.rb
112
+ - app/components/view_component/form/time_field_component.rb
113
+ - app/components/view_component/form/time_select_component.rb
114
+ - app/components/view_component/form/time_zone_select_component.rb
115
+ - app/components/view_component/form/url_field_component.rb
116
+ - app/components/view_component/form/week_field_component.rb
117
+ - lib/generators/vcf/builder/builder_generator.rb
118
+ - lib/generators/vcf/builder/templates/builder.rb.erb
119
+ - lib/view_component/form.rb
120
+ - lib/view_component/form/builder.rb
121
+ - lib/view_component/form/class_names_helper.rb
122
+ - lib/view_component/form/engine.rb
123
+ - lib/view_component/form/test_helpers.rb
124
+ - lib/view_component/form/version.rb
125
+ homepage: https://github.com/pantographe/view_component-form
126
+ licenses:
127
+ - MIT
128
+ metadata:
129
+ homepage_uri: https://github.com/pantographe/view_component-form
130
+ changelog_uri: https://github.com/pantographe/view_component-form/blob/master/CHANGELOG.md
131
+ source_code_uri: https://github.com/pantographe/view_component-form
132
+ bug_tracker_uri: https://github.com/pantographe/view_component-form/issues
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 2.7.0
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.2.9
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Rails FormBuilder for ViewComponent
152
+ test_files: []