hyperactiveform 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +25 -1
- data/docs/HyperActiveForm/Base.html +884 -0
- data/docs/HyperActiveForm/CancelFormSubmit.html +124 -0
- data/docs/HyperActiveForm/FormDidNotSubmitError.html +124 -0
- data/docs/HyperActiveForm/Generators/InstallGenerator.html +199 -0
- data/docs/HyperActiveForm/Generators.html +115 -0
- data/docs/HyperActiveForm.html +135 -0
- data/docs/_index.html +182 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +503 -0
- data/docs/file.README.html +271 -0
- data/docs/file_list.html +59 -0
- data/docs/frames.html +22 -0
- data/docs/index.html +271 -0
- data/docs/js/app.js +344 -0
- data/docs/js/full_list.js +242 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +126 -0
- data/docs/top-level-namespace.html +110 -0
- data/examples/basic.md +85 -0
- data/lib/hyper_active_form/base.rb +43 -5
- data/lib/hyper_active_form/version.rb +1 -1
- metadata +37 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bf224bb05aa53c3ffa3909697c1de9aec078b5b2b93bb714c986406ec09c96a
|
4
|
+
data.tar.gz: cd9237240accc63066e2cbb43f52db7f43ba4f767d11dfbd648621988e5ca747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b6c8634a4f830470618386a8e3b1b3dc0ef6b73808d5d74bdd45dd2f0a12f43983ae6a3cc5e0119cff0655a24f5e9902e674d3f78a01a182b743914e267b0f0
|
7
|
+
data.tar.gz: 78c2b176fdefc0c208ae01e5e884c5a324cd056a0f51177ebb27ca8be78dd93434bca7558814ab28bd79964a16dac9427119c2a422f60e6b117d49420b27142a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.0] - 2024-12-14
|
4
|
+
- Add callbacks for `assign_form_attributes` and `submit`
|
5
|
+
- 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`
|
6
|
+
|
3
7
|
## [0.1.0] - 2024-11-30
|
4
8
|
|
5
9
|
- Initial release
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ And then execute:
|
|
22
22
|
|
23
23
|
Run the install generator:
|
24
24
|
|
25
|
-
$ rails generate
|
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
|
|
@@ -211,3 +211,27 @@ class UsersController < ApplicationController
|
|
211
211
|
@users = @form.results
|
212
212
|
end
|
213
213
|
end
|
214
|
+
```
|
215
|
+
|
216
|
+
## Callbacks
|
217
|
+
|
218
|
+
HyperActiveForm provides callbacks for `assign_form_attributes` and `submit`.
|
219
|
+
|
220
|
+
You can use these callbacks to run code before or after assigning the form attributes or before or after submitting the form.
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
class ProfileForm < ApplicationForm
|
224
|
+
# ...
|
225
|
+
|
226
|
+
before_submit :do_something_before_submit
|
227
|
+
before_assign_form_attributes :do_something_before_assign_form_attributes
|
228
|
+
|
229
|
+
def do_something_before_submit
|
230
|
+
# Do something before submitting the form
|
231
|
+
end
|
232
|
+
|
233
|
+
def do_something_before_assign_form_attributes
|
234
|
+
# Do something before assigning the form attributes
|
235
|
+
end
|
236
|
+
end
|
237
|
+
```
|