phlexi-form 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +4 -9
  3. data/README.md +117 -316
  4. data/TODO +4 -0
  5. data/config.ru +0 -3
  6. data/gemfiles/default.gemfile.lock +22 -2
  7. data/gemfiles/rails_7.gemfile +8 -0
  8. data/gemfiles/rails_7.gemfile.lock +282 -0
  9. data/lib/phlexi/form/base.rb +65 -56
  10. data/lib/phlexi/form/components/base.rb +14 -8
  11. data/lib/phlexi/form/components/checkbox.rb +5 -0
  12. data/lib/phlexi/form/components/collection_checkboxes.rb +28 -14
  13. data/lib/phlexi/form/components/collection_radio_buttons.rb +19 -13
  14. data/lib/phlexi/form/components/concerns/extracts_input.rb +53 -0
  15. data/lib/phlexi/form/components/concerns/handles_array_input.rb +21 -0
  16. data/lib/phlexi/form/components/concerns/handles_input.rb +23 -0
  17. data/lib/phlexi/form/components/concerns/has_options.rb +6 -2
  18. data/lib/phlexi/form/components/concerns/submits_form.rb +47 -0
  19. data/lib/phlexi/form/components/error.rb +1 -1
  20. data/lib/phlexi/form/components/file_input.rb +33 -0
  21. data/lib/phlexi/form/components/hint.rb +1 -1
  22. data/lib/phlexi/form/components/input.rb +38 -36
  23. data/lib/phlexi/form/components/input_array.rb +45 -0
  24. data/lib/phlexi/form/components/label.rb +2 -1
  25. data/lib/phlexi/form/components/radio_button.rb +11 -1
  26. data/lib/phlexi/form/components/select.rb +21 -8
  27. data/lib/phlexi/form/components/submit_button.rb +41 -0
  28. data/lib/phlexi/form/components/textarea.rb +2 -3
  29. data/lib/phlexi/form/field_options/associations.rb +21 -0
  30. data/lib/phlexi/form/field_options/autofocus.rb +1 -1
  31. data/lib/phlexi/form/field_options/collection.rb +26 -9
  32. data/lib/phlexi/form/field_options/errors.rb +17 -3
  33. data/lib/phlexi/form/field_options/hints.rb +5 -1
  34. data/lib/phlexi/form/field_options/{type.rb → inferred_types.rb} +21 -17
  35. data/lib/phlexi/form/field_options/multiple.rb +2 -0
  36. data/lib/phlexi/form/field_options/required.rb +1 -1
  37. data/lib/phlexi/form/field_options/themes.rb +207 -0
  38. data/lib/phlexi/form/field_options/validators.rb +2 -2
  39. data/lib/phlexi/form/option_mapper.rb +2 -2
  40. data/lib/phlexi/form/structure/dom.rb +21 -16
  41. data/lib/phlexi/form/structure/field_builder.rb +165 -121
  42. data/lib/phlexi/form/structure/field_collection.rb +20 -6
  43. data/lib/phlexi/form/structure/namespace.rb +48 -31
  44. data/lib/phlexi/form/structure/namespace_collection.rb +20 -20
  45. data/lib/phlexi/form/structure/node.rb +13 -3
  46. data/lib/phlexi/form/version.rb +1 -1
  47. data/lib/phlexi/form.rb +4 -1
  48. metadata +32 -7
  49. data/CODE_OF_CONDUCT.md +0 -84
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 677bddc668db5f933dadf3bbe2057dc3463dda9efc7ea47cbbb4d79ec907bc9c
4
- data.tar.gz: fe050eaa5f4e946c14fd69285ca93e4f1ed4ac0a4b079a7fb8976cadb4695381
3
+ metadata.gz: d20cf0d6ccfcdf3cbb3a05a518b25a9b6176ef827e32f9cab47fddb43391f470
4
+ data.tar.gz: '0788efe146100a6629f679d913a080ff7cc2039881477bc9ffda16dfe0f6dc9f'
5
5
  SHA512:
6
- metadata.gz: fffc444e797c5fead7b45308e05cc94bc0b9d3da7c389c1eb199867c18b3c834058b7ad8ae7a34a805e0e05c9d15897051b59efdaf213b16a17a991af571d42c
7
- data.tar.gz: df80447cf6f4263e5303f39b219ff8615f303e106abce319a55d4289e382aba32aff65df08e746a75045427f15403e742d8bbb38c4cfef611935df1f1706bd09
6
+ metadata.gz: 3e671e22b8daa6e5e243725f79302e26b9b1d5395d92a54013d0aed981bc9eb2dfd756d8214a69446e0328186b339dc21dd3e1853c5236270f048e974c4ae114
7
+ data.tar.gz: d7441ae010f74f188baf43b6ac90e5cdd49b88563a22261e223b11d3c20de6135e5f610c0f278eaae28d49bc3627df3ec0b3012fe49d5e41626751d15200fd26
data/Appraisals CHANGED
@@ -2,12 +2,7 @@ appraise "default" do
2
2
  # gem "phlex", "~> 1.10"
3
3
  end
4
4
 
5
- # appraise "rails-7" do
6
- # gem "rails", "~> 7.1.3", ">= 7.1.3.4"
7
- # gem "sqlite3", "~> 1.4"
8
- # gem "puma", ">= 5.0"
9
- # gem "importmap-rails"
10
- # gem "turbo-rails"
11
- # gem "stimulus-rails"
12
- # gem "tzinfo-data", platforms: %i[windows jruby]
13
- # end
5
+ appraise "rails-7" do
6
+ gem "rails", "~> 7.1.3", ">= 7.1.3.4"
7
+ gem "sqlite3", "~> 1.4"
8
+ end
data/README.md CHANGED
@@ -1,395 +1,196 @@
1
- # Superform
1
+ # Phlexi::Form
2
2
 
3
- Superform aims to be the best way to build forms in Rails applications. Here's what it does differently.
3
+ Phlexi::Form is a flexible and powerful form builder for Ruby applications. It provides a more customizable and extensible way to create forms compared to traditional form helpers.
4
4
 
5
- * **Everything is a component.** Superform is built on top of [Phlex](https://phlex.fun), so every bit of HTML in the form can be customized to your precise needs. Use it with your own CSS Framework or go crazy customizing every last bit of TailwindCSS.
5
+ [![Ruby](https://github.com/radioactive-labs/phlexi-form/actions/workflows/main.yml/badge.svg)](https://github.com/radioactive-labs/phlexi-form/actions/workflows/main.yml)
6
6
 
7
- * **Automatic strong parameters.** Superform automatically permits form fields so you don't have to facepalm yourself after adding a field, wondering why it doesn't persist, only to realize you forgot to add the parameter to your controller. No more! Superform was architected with safety & security in mind, meaning it can automatically permit your form parameters.
7
+ ## Features
8
8
 
9
- * **Compose complex forms with Plain 'ol Ruby Objects.** Superform is built on top of POROs, so you can easily compose classes, modules, & ruby code together to create complex forms. You can even extend forms to create new forms with a different look and feel.
9
+ - Customizable form components (input, select, checkbox, radio button, etc.)
10
+ - Automatic field type and attribute inference based on model attributes
11
+ - Built-in support for validations and error handling
12
+ - Flexible form structure with support for nested attributes
13
+ - Works with Phlex or erb views
14
+ - Extract input from parameters that match your form definition. No need to strong paramters.
15
+ - Rails compatible form inputs
10
16
 
11
- It's a complete rewrite of Rails form's internals that's inspired by Reactive component design patterns.
12
-
13
- [![Maintainability](https://api.codeclimate.com/v1/badges/0e4dfe2a1ece26e3a59e/maintainability)](https://codeclimate.com/github/rubymonolith/superform/maintainability) [![Ruby](https://github.com/rubymonolith/superform/actions/workflows/main.yml/badge.svg)](https://github.com/rubymonolith/superform/actions/workflows/main.yml)
14
17
 
15
18
  ## Installation
16
19
 
17
- Add to the Rails application's Gemfile by executing:
18
-
19
- $ bundle add superform
20
-
21
- Then install it.
22
-
23
- $ rails g superform:install
24
-
25
- This will install both Phlex Rails and Superform.
26
-
27
- ## Usage
28
-
29
- Superform streamlines the development of forms on Rails applications by making everything a component.
30
-
31
- After installing, create a form in `app/views/*/form.rb`. For example, a form for a `Post` resource might look like this.
20
+ Add this line to your application's Gemfile:
32
21
 
33
22
  ```ruby
34
- # ./app/views/posts/form.rb
35
- class Posts::Form < ApplicationForm
36
- def template(&)
37
- row field(:title).input
38
- row field(:body).textarea
39
- row field(:blog).select Blog.select(:id, :title)
40
- end
41
- end
23
+ gem 'phlexi-form'
42
24
  ```
43
25
 
44
- Then render it in your templates. Here's what it looks like from an Erb file.
26
+ And then execute:
45
27
 
46
- ```erb
47
- <h1>New post</h1>
48
- <%= render Posts::Form.new @post %>
49
28
  ```
50
-
51
- ## Customization
52
-
53
- Superforms are built out of [Phlex components](https://www.phlex.fun/html/components/). The method names correspeond with the HTML tag, its arguments are attributes, and the blocks are the contents of the tag.
54
-
55
- ```ruby
56
- # ./app/views/forms/application_form.rb
57
- class ApplicationForm < Superform::Rails::Form
58
- class MyInputComponent < Superform::Rails::Components::InputComponent
59
- def template(&)
60
- div class: "form-field" do
61
- input(**attributes)
62
- end
63
- end
64
- end
65
-
66
- class Field < Superform::Rails::Form::Field
67
- def input(**attributes)
68
- MyInputComponent.new(self, attributes: attributes)
69
- end
70
- end
71
-
72
- def labeled(component)
73
- div class: "form-row" do
74
- render component.field.label
75
- render component
76
- end
77
- end
78
-
79
- def submit(text)
80
- button(type: :submit) { text }
81
- end
82
- end
29
+ $ bundle install
83
30
  ```
84
31
 
85
- That looks like a LOT of code, and it is, but look at how easy it is to create forms.
32
+ Or install it yourself as:
86
33
 
87
- ```ruby
88
- # ./app/views/users/form.rb
89
- class Users::Form < ApplicationForm
90
- def template(&)
91
- labeled field(:name).input
92
- labeled field(:email).input(type: :email)
93
-
94
- submit "Sign up"
95
- end
96
- end
97
34
  ```
98
-
99
- Then render it from Erb.
100
-
101
- ```erb
102
- <%= render Users::Form.new @user %>
35
+ $ gem install phlexi-form
103
36
  ```
104
37
 
105
- Much better!
106
-
107
- ## Namespaces & Collections
38
+ ## Usage
108
39
 
109
- Superform uses a different syntax for namespacing and collections than Rails, which can be a bit confusing since the same terminology is used but the application is slightly different.
40
+ There are 2 ways to use Phlexi::Form:
110
41
 
111
- Consider a form for an account that lets people edit the names and email of the owner and users of an account.
42
+ ### Direct Usage
112
43
 
113
44
  ```ruby
114
- class AccountForm < Superform::Rails::Form
115
- def template
116
- # Account#owner returns a single object
117
- namespace :owner do |owner|
118
- # Renders input with the name `account[owner][name]`
119
- render owner.field(:name).input
120
- # Renders input with the name `account[owner][email]`
121
- render owner.field(:email).input(type: :email)
122
- end
123
-
124
- # Account#members returns a collection of objects
125
- collection(:members).each do |member|
126
- # Renders input with the name `account[members][0][name]`,
127
- # `account[members][1][name]`, ...
128
- render member.field(:name).input
129
- # Renders input with the name `account[members][0][email]`,
130
- # `account[members][1][email]`, ...
131
- render member.field(:email).input(type: :email)
132
-
133
- # Member#permissions returns an array of values like
134
- # ["read", "write", "delete"].
135
- member.field(:permissions).collection do |permission|
136
- # Renders input with the name `account[members][0][permissions][]`,
137
- # `account[members][1][permissions][]`, ...
138
- render permission.label do
139
- plain permisson.value.humanize
140
- render permission.checkbox
141
- end
142
- end
143
- end
45
+ Phlexi::Form(User.new) do
46
+ field(:name) do |name|
47
+ render name.label_tag
48
+ render name.input_tag
144
49
  end
145
- end
146
- ```
147
-
148
- One big difference between Superform and Rails is the `collection` methods require the use of the `each` method to enumerate over each item in the collection.
149
-
150
- There's three different types of namespaces and collections to consider:
151
-
152
- 1. **Namespace** - `namespace(:field_name)` is used to map form fields to a single object that's a child of another object. In ActiveRecord, this could be a `has_one` or `belongs_to` relationship.
153
50
 
154
- 2. **Collection** - `collection(:field_name).each` is used to map a collection of objects to a form. In this case, the members of the account. In ActiveRecord, this could be a `has_many` relationship.
155
-
156
- 3. **Field Collection** - `field(:field_name).collection.each` is used when the value of a field is enumerable, like an array of values. In ActiveRecord, this could be an attribute that's an Array type.
157
-
158
- ### Change a form's root namespace
159
-
160
- By default Superform namespaces a form based on the ActiveModel model name param key.
161
-
162
- ```ruby
163
- class UserForm < Superform::Rails::Form
164
- def template
165
- render field(:email).input
51
+ field(:email) do |email|
52
+ render email.label_tag
53
+ render email.input_tag
166
54
  end
167
- end
168
55
 
169
- render LoginForm.new(User.new)
170
- # Renders input with the name `user[email]`
171
-
172
- render LoginForm.new(Admin::User.new)
173
- # Renders input with the name `admin_user[email]`
174
- ```
175
-
176
- To customize the form namespace, like an ActiveRecord model nested within a module, the `key` method can be overriden.
56
+ nest_one(:address) do |address|
57
+ address.field(:street) do |street|
58
+ render street.label_tag
59
+ render street.input_tag
60
+ end
177
61
 
178
- ```ruby
179
- class UserForm < Superform::Rails::Form
180
- def template
181
- render field(:email).input
182
- end
183
-
184
- def key
185
- "user"
62
+ address.field(:city) do |city|
63
+ render city.label_tag
64
+ render city.input_tag
65
+ end
186
66
  end
187
- end
188
67
 
189
- render UserForm.new(User.new)
190
- # Renders input with the name `user[email]`
191
-
192
- render UserForm.new(Admin::User.new)
193
- # This will also render inputs with the name `user[email]`
68
+ render submit_button
69
+ end
194
70
  ```
195
71
 
196
- ## Form field guide
197
-
198
- Superform tries to strike a balance between "being as close to HTML forms as possible" and not requiring a lot of boilerplate to create forms. This example is contrived, but it shows all the different ways you can render a form.
199
-
200
- In practice, many of the calls below you'd put inside of a method. This cuts down on the number of `render` calls in your HTML code and further reduces boilerplate.
72
+ > **Important**
73
+ >
74
+ > If you are rendering your form inline e.g.
75
+ > ```ruby
76
+ > render Phlexi::Form(User.new) {
77
+ > render field(:name).label_tag
78
+ > render field(:name).input_tag
79
+ > }
80
+ > ```
81
+ >
82
+ > Make sure you use `{...}` in defining your block instead of `do...end`
83
+ > This might be fixed in a future version.
84
+
85
+ ### Inherit form
201
86
 
202
87
  ```ruby
203
- # Everything below is intentionally verbose!
204
- class SignupForm < ApplicationForm
205
- def template
206
- # The most basic type of input, which will be autofocused.
207
- render field(:name).input.focus
208
-
209
- # Input field with a lot more options on it.
210
- render field(:email).input(type: :email, placeholder: "We will sell this to third parties", required: true)
211
-
212
- # You can put fields in a block if that's your thing.
213
- render field(:reason) do |f|
214
- div do
215
- f.label { "Why should we care about you?" }
216
- f.textarea(row: 3, col: 80)
217
- end
88
+ class UserForm < Phlexi::Form::Base
89
+ def form_template
90
+ field(:name) do |name|
91
+ render name.label_tag
92
+ render name.input_tag
218
93
  end
219
94
 
220
- # Let's get crazy with Selects. They can accept values as simple as 2 element arrays.
221
- div do
222
- render field(:contact).label { "Would you like us to spam you to death?" }
223
- render field(:contact).select(
224
- [true, "Yes"], # <option value="true">Yes</option>
225
- [false, "No"], # <option value="false">No</option>
226
- "Hell no", # <option value="Hell no">Hell no</option>
227
- nil # <option></option>
228
- )
95
+ field(:email) do |email|
96
+ render email.label_tag
97
+ render email.input_tag
229
98
  end
230
99
 
231
- div do
232
- render field(:source).label { "How did you hear about us?" }
233
- render field(:source).select do |s|
234
- # Pretend WebSources is an ActiveRecord scope with a "Social" category that has "Facebook, X, etc"
235
- # and a "Search" category with "AltaVista, Yahoo, etc."
236
- WebSources.select(:id, :name).group_by(:category) do |category, sources|
237
- s.optgroup(label: category) do
238
- s.options(sources)
239
- end
240
- end
100
+ nest_one(:address) do |address|
101
+ address.field(:street) do |street|
102
+ render street.label_tag
103
+ render street.input_tag
241
104
  end
242
- end
243
105
 
244
- div do
245
- render field(:agreement).label { "Check this box if you agree to give us your first born child" }
246
- render field(:agreement).checkbox(checked: true)
106
+ address.field(:city) do |city|
107
+ render city.label_tag
108
+ render city.input_tag
109
+ end
247
110
  end
248
111
 
249
- render button { "Submit" }
112
+ render submit_button
250
113
  end
251
114
  end
252
- ```
253
115
 
254
- ### Upload fields
255
- If you want to add file upload fields to your form you will need to initialize your form with the `enctype` attribute set to `multipart/form-data` as shown in the following example code:
256
116
 
257
- ```ruby
258
- class User::ImageForm < ApplicationForm
259
- def template
260
- # render label
261
- render field(:image).label { "Choose file" }
262
- # render file input with accept attribute for png and jpeg images
263
- render field(:image).input(type: "file", accept: "image/png, image/jpeg")
264
- end
265
- end
117
+ # In your view or controller
118
+ form = UserForm.new(User.new)
266
119
 
267
- # IMPORTANT
268
- # When rendering the form remember to init the User::ImageForm like that
269
- render User::ImageForm.new(@usermodel, enctype: "multipart/form-data")
120
+ # Render the form
121
+ render form
122
+
123
+ # Extract params
124
+ form.extract_input({
125
+ name: "Brad Pitt",
126
+ email: "brad@pitt.com",
127
+ address: {
128
+ street: "Plumbago",
129
+ city: "Accra",
130
+ }
131
+ })
270
132
  ```
271
133
 
134
+ ## Advanced Usage
272
135
 
273
- ## Extending Superforms
136
+ ### Custom Components
274
137
 
275
- The best part? If you have forms with a completely different look and feel, you can extend the forms just like you would a Ruby class:
138
+ You can create custom form components by inheriting from `Phlexi::Form::Components::Base`:
276
139
 
277
140
  ```ruby
278
- class AdminForm < ApplicationForm
279
- class AdminInput < ApplicationComponent
280
- def template(&)
141
+ class CustomInput < Phlexi::Form::Components::Base
142
+ def template
143
+ div(class: "custom-input") do
281
144
  input(**attributes)
282
- small { admin_tool_tip_for field.key }
283
- end
284
- end
285
-
286
- class Field < Field
287
- def tooltip_input(**attributes)
288
- AdminInput.new(self, attributes: attributes)
145
+ span(class: "custom-icon")
289
146
  end
290
147
  end
291
148
  end
292
- ```
293
-
294
- Then, just like you did in your Erb, you create the form:
295
-
296
- ```ruby
297
- class Admin::Users::Form < AdminForm
298
- def template(&)
299
- labeled field(:name).tooltip_input
300
- labeled field(:email).tooltip_input(type: :email)
301
149
 
302
- submit "Save"
303
- end
150
+ # Usage in your form
151
+ field(:custom_field) do |field|
152
+ render CustomInput.new(field)
304
153
  end
305
154
  ```
306
155
 
307
- Since Superforms are just Ruby objects, you can organize them however you want. You can keep your view component classes embedded in your Superform file if you prefer for everything to be in one place, keep the forms in the `app/views/forms/*.rb` folder and the components in `app/views/forms/**/*_component.rb`, use Ruby's `include` and `extend` features to modify different form classes, or put them in a gem and share them with an entire organization or open source community. It's just Ruby code!
308
-
309
- ## Automatic strong parameters
156
+ ### Theming
310
157
 
311
- Guess what? Superform eliminates the need for Strong Parameters in Rails by assigning the values of the `params` hash _through_ your form via the `assign` method. Here's what it looks like.
158
+ Phlexi::Form supports theming through a flexible theming system:
312
159
 
313
160
  ```ruby
314
- class PostsController < ApplicationController
315
- include Superform::Rails::StrongParameters
316
-
317
- def create
318
- @post = assign params.require(:post), to: Posts::Form.new(Post.new)
319
-
320
- if @post.save
321
- # Success path
322
- else
323
- # Error path
324
- end
325
- end
326
-
327
- def update
328
- @post = Post.find(params[:id])
329
-
330
- assign params.require(:post), to: Posts::Form.new(@post)
331
-
332
- if @post.save
333
- # Success path
334
- else
335
- # Error path
161
+ class ThemedForm < Phlexi::Form::Base
162
+ class FieldBuilder < FieldBuilder
163
+ private
164
+
165
+ def default_theme
166
+ {
167
+ input: "border rounded px-2 py-1",
168
+ label: "font-bold text-gray-700",
169
+ # Add more theme options here
170
+ }
336
171
  end
337
172
  end
338
173
  end
339
174
  ```
340
175
 
341
- How does it work? An instance of the form is created, then the hash is assigned to it. If the params include data outside of what a form accepts, it will be ignored.
342
-
343
- ## Comparisons
344
-
345
- Rails ships with a lot of great options to make forms. Many of these inspired Superform. The tl;dr:
346
-
347
- 1. Rails has a lot of great form helpers. Simple Form and Formtastic both have concise ways of defining HTML forms, but do require frequently opening and closing Erb tags.
348
-
349
- 2. Superform is uniquely capable of permitting its own controller parameters, leaving you with one less thing to worry about and test. Additionally it can be extended, shared, and modularized since its Plain' 'ol Ruby, which opens up a world of TailwindCSS form libraries and proprietary form libraries developed internally by organizations.
350
-
351
- ### Rails form helpers
352
-
353
- Rails form helpers have lasted for almost 20 years and are super solid, but things get tricky when your application starts to take on different styles of forms. To manage it all you have to cobble together helper methods, partials, and templates. Additionally, the structure of the form then has to be expressed to the controller as strong params, forcing you to repeat yourself.
354
-
355
- With Superform, you build the entire form with Ruby code, so you avoid the Erb gymnastics and helper method soup that it takes in Rails to scale up forms in an organization.
356
-
357
- ### Simple Form
358
-
359
- I built some pretty amazing applications with Simple Form and admire its syntax. It requires "Erb soup", which is an opening and closing line of Erb per line. If you follow a specific directory structure or use their component framework, you can get pretty far, but you'll hit a wall when you need to start putting wrappers around forms or inputs.
176
+ <!-- ## Configuration
360
177
 
361
- https://github.com/heartcombo/simple_form#the-wrappers-api
178
+ You can configure Phlexi::Form globally by creating an initializer:
362
179
 
363
- The API is there, but when you change the syntax, you have to reboot the server to see the changes. UI development should be reflected immediately when the page is reloaded, which is what Superforms can do.
364
-
365
- Like Rails form helpers, it doesn't self-permit parameters.
366
-
367
- https://www.ruby-toolbox.com/projects/simple_form
368
-
369
- ### Formtastic
370
-
371
- Formtastic gives us a nice DSL inside of Erb that we can use to create forms, but like Simple Form, there's a lot of opening and closing Erb tags that make the syntax clunky.
372
-
373
- It has generators that give you Ruby objects that represent HTML form inputs that you can customize, but its limited to very specific parts of the HTML components. Superform lets you customize every aspect of the HTML in your form elements.
374
-
375
- It also does not permit its own parameters.
376
-
377
- https://www.ruby-toolbox.com/projects/formtastic
378
-
379
- ## Development
380
-
381
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
382
-
383
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
180
+ ```ruby
181
+ # config/initializers/phlexi_form.rb
182
+ Phlexi::Form.configure do |config|
183
+ config.default_theme = {
184
+ # Your default theme options
185
+ }
186
+ # Add more configuration options here
187
+ end
188
+ ``` -->
384
189
 
385
190
  ## Contributing
386
191
 
387
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubymonolith/superform. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rubymonolith/superform/blob/main/CODE_OF_CONDUCT.md).
192
+ Bug reports and pull requests are welcome on GitHub at https://github.com/radioactive-labs/phlexi-form.
388
193
 
389
194
  ## License
390
195
 
391
196
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
392
-
393
- ## Code of Conduct
394
-
395
- Everyone interacting in the Superform project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rubymonolith/superform/blob/main/CODE_OF_CONDUCT.md).
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ - Add tests for primary_key
2
+ - Ensure composite primary keys are supported
3
+ - add tests for formmethod override in submit_button
4
+ - how can we automatically infer the file types accepted by the file_input component
data/config.ru CHANGED
@@ -4,6 +4,3 @@ require "rubygems"
4
4
  require "bundler"
5
5
 
6
6
  Bundler.require :default, :development
7
-
8
- # Combustion.initialize! :all
9
- # run Combustion::Application
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- phlexi-form (0.1.0)
4
+ phlexi-form (0.3.0.rc1)
5
5
  activesupport
6
- phlex (~> 1.10)
6
+ phlex (~> 1.11)
7
7
  zeitwerk
8
8
 
9
9
  GEM
@@ -35,6 +35,8 @@ GEM
35
35
  minitest (>= 5.1)
36
36
  mutex_m
37
37
  tzinfo (~> 2.0)
38
+ addressable (2.8.7)
39
+ public_suffix (>= 2.0.2, < 7.0)
38
40
  ansi (1.5.0)
39
41
  appraisal (2.5.0)
40
42
  bundler
@@ -49,6 +51,15 @@ GEM
49
51
  bundler-audit (0.9.1)
50
52
  bundler (>= 1.2.0, < 3)
51
53
  thor (~> 1.0)
54
+ capybara (3.40.0)
55
+ addressable
56
+ matrix
57
+ mini_mime (>= 0.1.3)
58
+ nokogiri (~> 1.11)
59
+ rack (>= 1.6.0)
60
+ rack-test (>= 0.6.3)
61
+ regexp_parser (>= 1.5, < 3.0)
62
+ xpath (~> 3.2)
52
63
  combustion (1.5.0)
53
64
  activesupport (>= 3.0.0)
54
65
  railties (>= 3.0.0)
@@ -70,6 +81,8 @@ GEM
70
81
  loofah (2.22.0)
71
82
  crass (~> 1.0.2)
72
83
  nokogiri (>= 1.12.0)
84
+ matrix (0.4.2)
85
+ mini_mime (1.1.5)
73
86
  minitest (5.24.1)
74
87
  minitest-reporters (1.7.1)
75
88
  ansi
@@ -84,8 +97,12 @@ GEM
84
97
  ast (~> 2.4.1)
85
98
  racc
86
99
  phlex (1.11.0)
100
+ phlex-testing-capybara (0.1.0)
101
+ capybara (~> 3.38)
102
+ phlex (>= 0.5)
87
103
  psych (5.1.2)
88
104
  stringio
105
+ public_suffix (6.0.1)
89
106
  racc (1.8.1)
90
107
  rack (3.1.7)
91
108
  rack-session (2.0.0)
@@ -155,6 +172,8 @@ GEM
155
172
  concurrent-ruby (~> 1.0)
156
173
  unicode-display_width (2.5.0)
157
174
  webrick (1.8.1)
175
+ xpath (3.2.0)
176
+ nokogiri (~> 1.8)
158
177
  zeitwerk (2.6.17)
159
178
 
160
179
  PLATFORMS
@@ -166,6 +185,7 @@ DEPENDENCIES
166
185
  combustion
167
186
  minitest
168
187
  minitest-reporters
188
+ phlex-testing-capybara
169
189
  phlexi-form!
170
190
  rake
171
191
  standard
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 7.1.3", ">= 7.1.3.4"
6
+ gem "sqlite3", "~> 1.4"
7
+
8
+ gemspec path: "../"