vue-form-for 0.3.3 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +17 -0
- data/lib/vue-form-for/form_builder.rb +9 -6
- data/lib/vue-form-for/vue_options_resolver.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0520bfe0687ca8fe0d7fa4ce7ee8520b789b1b26
|
4
|
+
data.tar.gz: 7ca3b9e211ae547545beb3577ec0e6a38e509bc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a75589afbfd826b6bf64fe8c86e07a48c48a741eec6df58ee067299656f1b27bb2320aeb519cb3769dbfd3dcef3bb14d74afa8d4512497cd05319bf55f5c514
|
7
|
+
data.tar.gz: 773e02a95506fc450a75fe04fb11a10324b5c733fa0c852751d2107e9b717885a6bb521edfd6fab5cf6415ee62e009563ab58087ebe4016bd9db6dfdc51b6d09
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
vue-form-for
|
2
2
|
============
|
3
3
|
|
4
|
+
[](https://badge.fury.io/rb/vue-form-for)
|
5
|
+
|
4
6
|
A custom Rails form builder for Vue.js
|
5
7
|
|
6
8
|
Synopsis
|
@@ -195,6 +197,21 @@ Example:
|
|
195
197
|
<% end %>
|
196
198
|
```
|
197
199
|
|
200
|
+
Data Initialization
|
201
|
+
-------------------
|
202
|
+
|
203
|
+
As the official Vue.js document says:
|
204
|
+
|
205
|
+
> `v-model` will ignore the initial `value`, `checked` or `selected` attributes
|
206
|
+
> found on any form elements.
|
207
|
+
> (https://vuejs.org/v2/guide/forms.html)
|
208
|
+
|
209
|
+
Because of this, all form controls get reset after the Vue component is mounted.
|
210
|
+
|
211
|
+
However, you can use
|
212
|
+
[vue-data-scooper](https://github.com/kuroda/vue-data-scooper) plugin
|
213
|
+
in order to keep the original state of the form.
|
214
|
+
|
198
215
|
License
|
199
216
|
-------
|
200
217
|
|
@@ -9,8 +9,7 @@ module VueFormFor
|
|
9
9
|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
10
10
|
def #{selector}(method, options = {})
|
11
11
|
resolve_vue_options(options)
|
12
|
-
|
13
|
-
options[:"v-model"] ||= "\#{namespace}.\#{method}"
|
12
|
+
add_v_model_attribute(method, options)
|
14
13
|
super(method, options)
|
15
14
|
end
|
16
15
|
RUBY_EVAL
|
@@ -23,18 +22,22 @@ module VueFormFor
|
|
23
22
|
|
24
23
|
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
25
24
|
resolve_vue_options(options)
|
26
|
-
|
27
|
-
options[:"v-model"] ||= "#{namespace}.#{method}"
|
25
|
+
add_v_model_attribute(method, options)
|
28
26
|
super(method, options, checked_value, unchecked_value)
|
29
27
|
end
|
30
28
|
|
31
29
|
def radio_button(method, tag_value, options = {})
|
32
30
|
resolve_vue_options(options)
|
33
|
-
|
34
|
-
options[:"v-model"] ||= "#{namespace}.#{method}"
|
31
|
+
add_v_model_attribute(method, options)
|
35
32
|
super(method, tag_value, options)
|
36
33
|
end
|
37
34
|
|
35
|
+
def select(method, choices = nil, options = {}, html_options = {}, &block)
|
36
|
+
resolve_vue_options(html_options)
|
37
|
+
add_v_model_attribute(method, html_options)
|
38
|
+
super(method, choices, options, html_options, &block)
|
39
|
+
end
|
40
|
+
|
38
41
|
def submit(value = nil, options = {})
|
39
42
|
resolve_vue_options(options)
|
40
43
|
super(value, options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vue-form-for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsutomu KURODA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|