hyperactiveform 0.1.0 → 0.3.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
  SHA256:
3
- metadata.gz: 9bf33b760b731a44e34fd302e0d0d4049f9dd04cfeaeff043a32992f6a8c01d7
4
- data.tar.gz: 556cb734a8ee3eabf099240c26a709b19214b30e65d0c731e233e58b2984565f
3
+ metadata.gz: c05e1cc748050b5a735f9f2fc3944427e5a3618b8083fa8ab9e3667a8d9f5f9a
4
+ data.tar.gz: e990037c9b3fcbcb5f2e68790c486f1a11bc541bb2680d2a312fa9a8336ca5e4
5
5
  SHA512:
6
- metadata.gz: 129e1e5a36f424767e7135339ade191302fd7b03cee66695abb9eaa4e274fb521a811d3bbd6b8c3e1fb8934e8a66c94ce75a7e99712ca3fe6bd40ee15949d670
7
- data.tar.gz: 381d63d878a72e386c4b0156be4836d54095b503e6640ebacbd2a4b441d924422b11bc583affc291a493c0514b0fcd57f46f9fdea917a7b9403fd36c1847f5fb
6
+ metadata.gz: 56384a8814889a64eb844f60c9eb5eb22335d0143d83a2e2f9dcf662090ce44d9d794bdc632a4a2d672ed07c510718d63bed04e597ec657ca40ac1ec5be66fa4
7
+ data.tar.gz: 9cf4cb7e27b70e97687f19f5f860df6529e925d741c7f42d87c0c28b05a953bffcfeddbc2c72ef172b25af3ab79bc43d641d01d9718bfbbd1bba79a1b902a0b6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-12-22
4
+ - Add generators (`rails generate form foo`) ([#2](https://github.com/Intrepidd/hyperactiveform/pull/2) by [@tchiadeu](https://github.com/tchiadeu))
5
+
6
+ ## [0.2.0] - 2024-12-14
7
+ - Add callbacks for `assign_form_attributes` and `submit`
8
+ - Change behavior of `assign_form_attributes`/`submit` to use the default value or nil if no value is provided, rather than keeping the value from `setup`
9
+
3
10
  ## [0.1.0] - 2024-11-30
4
11
 
5
12
  - Initial release
data/README.md CHANGED
@@ -22,10 +22,20 @@ And then execute:
22
22
 
23
23
  Run the install generator:
24
24
 
25
- $ rails generate hyperactiveform:install
25
+ $ rails generate hyper_active_form:install
26
26
 
27
27
  this will create an `ApplicationForm` class in your app/forms directory. You can use it as a base class for your form objects.
28
28
 
29
+ ## Generators
30
+
31
+ You can [generate](https://guides.rubyonrails.org/configuring.html#configuring-generators) a form and its tests with the following command:
32
+
33
+ ```
34
+ $ rails generate form FooBar
35
+ ```
36
+
37
+ This will create the `FooBarForm`
38
+
29
39
  ## Usage
30
40
 
31
41
  Here is an example of an `HyperActiveForm` form object:
@@ -211,3 +221,27 @@ class UsersController < ApplicationController
211
221
  @users = @form.results
212
222
  end
213
223
  end
224
+ ```
225
+
226
+ ## Callbacks
227
+
228
+ HyperActiveForm provides callbacks for `assign_form_attributes` and `submit`.
229
+
230
+ You can use these callbacks to run code before or after assigning the form attributes or before or after submitting the form.
231
+
232
+ ```ruby
233
+ class ProfileForm < ApplicationForm
234
+ # ...
235
+
236
+ before_submit :do_something_before_submit
237
+ before_assign_form_attributes :do_something_before_assign_form_attributes
238
+
239
+ def do_something_before_submit
240
+ # Do something before submitting the form
241
+ end
242
+
243
+ def do_something_before_assign_form_attributes
244
+ # Do something before assigning the form attributes
245
+ end
246
+ end
247
+ ```