vue-form-for 0.3.1 → 0.3.2
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 +5 -1
- data/README.md +37 -23
- data/lib/vue-form-for/form_builder.rb +2 -1
- 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: 7cfed9a785f58f2020654b8185875f61ace1deef
|
4
|
+
data.tar.gz: 9f49c4fd722d81122b5db8373297e931fe1b2b61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f3a9ff3d169231c4269943a7f154cdb0213020d34bb346c213b12f7e25b6e7960440eb9f9be4d17f15187b681f715198c632a987c0bb96aeef4e9fef760e550
|
7
|
+
data.tar.gz: d7c4e128b0d0328ddfb89f245be38fbda1303b21940e86011c5b09a3a5cf9c07db3546049c4b2dfef912718c0926b1263abebb5ed65afa8407ce2d4bc95b03ba
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# CHANGELOG - vue-form-for
|
2
2
|
|
3
|
+
## 0.3.2 (2017-05-09)
|
4
|
+
|
5
|
+
* Generate correct value for v-model on nested form.
|
6
|
+
|
3
7
|
## 0.3.1 (2017-04-11)
|
4
8
|
|
5
|
-
* Fix `check_box` and `radio_button` helper methods
|
9
|
+
* Fix `check_box` and `radio_button` helper methods.
|
6
10
|
|
7
11
|
## 0.3.0 (2017-04-09)
|
8
12
|
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ A custom Rails form builder for Vue.js
|
|
6
6
|
Synopsis
|
7
7
|
--------
|
8
8
|
|
9
|
-
```
|
9
|
+
```erb
|
10
10
|
<%= vue_form_for User.new do |f| %>
|
11
11
|
<%= f.text_field :name %>
|
12
12
|
<% end %>
|
@@ -33,7 +33,7 @@ Run `bundle install` on the terminal.
|
|
33
33
|
Usage
|
34
34
|
-----
|
35
35
|
|
36
|
-
```
|
36
|
+
```erb
|
37
37
|
<%= vue_form_for User.new do |f| %>
|
38
38
|
<%= f.text_field :name %>
|
39
39
|
<%= f.submit "Create" %>
|
@@ -75,7 +75,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
75
75
|
|
76
76
|
Add this line to the ERB template:
|
77
77
|
|
78
|
-
```
|
78
|
+
```erb
|
79
79
|
<%= javascript_pack_tag "new_user_form" %>
|
80
80
|
```
|
81
81
|
|
@@ -96,16 +96,16 @@ they get transformed into the Vue.js `v-bind` directives.
|
|
96
96
|
|
97
97
|
In the example below, these two lines have the same result:
|
98
98
|
|
99
|
-
```
|
100
|
-
<%= vue_content_tag(:span, "Hello", bind: { style: "{ color: textColor }" })
|
101
|
-
<%= vue_content_tag(:span, "Hello", "v-bind:style" => "{ color: textColor }" })
|
99
|
+
```erb
|
100
|
+
<%= vue_content_tag(:span, "Hello", bind: { style: "{ color: textColor }" }) %>
|
101
|
+
<%= vue_content_tag(:span, "Hello", "v-bind:style" => "{ color: textColor }" }) %>
|
102
102
|
```
|
103
103
|
|
104
104
|
Note that you should use the latter style if you want to specify *modifiers*
|
105
105
|
to the `v-bind` directives. For example:
|
106
106
|
|
107
|
-
```
|
108
|
-
<%= vue_content_tag(:span, "Hello", "v-bind:text-content.prop" => "message" })
|
107
|
+
```erb
|
108
|
+
<%= vue_content_tag(:span, "Hello", "v-bind:text-content.prop" => "message" }) %>
|
109
109
|
```
|
110
110
|
|
111
111
|
### The `:on` option
|
@@ -115,17 +115,17 @@ they get transformed into the Vue.js `v-on` directives.
|
|
115
115
|
|
116
116
|
In the example below, these two lines have the same result:
|
117
117
|
|
118
|
-
```
|
119
|
-
<%= vue_content_tag(:span, "Hello", on: { click: "doThis" })
|
120
|
-
<%= vue_content_tag(:span, "Hello", "v-on:click" => "doThis" })
|
118
|
+
```erb
|
119
|
+
<%= vue_content_tag(:span, "Hello", on: { click: "doThis" }) %>
|
120
|
+
<%= vue_content_tag(:span, "Hello", "v-on:click" => "doThis" }) %>
|
121
121
|
```
|
122
122
|
|
123
123
|
Note that you should use the latter style if you want to specify *modifiers*
|
124
124
|
to the `v-on` directives. For example:
|
125
125
|
|
126
|
-
```
|
127
|
-
<%= vue_content_tag(:span, "Hello", "v-on:click.once" => "doThis" })
|
128
|
-
<%= vue_content_tag(:button, "Hello", "v-on:click.prevent" => "doThis" })
|
126
|
+
```erb
|
127
|
+
<%= vue_content_tag(:span, "Hello", "v-on:click.once" => "doThis" }) %>
|
128
|
+
<%= vue_content_tag(:button, "Hello", "v-on:click.prevent" => "doThis" }) %>
|
129
129
|
```
|
130
130
|
|
131
131
|
### Boolean attributes
|
@@ -136,11 +136,25 @@ the key gets transformed by adding `v-bind:` to its head.
|
|
136
136
|
|
137
137
|
In the example below, these two lines have the same result:
|
138
138
|
|
139
|
+
```erb
|
140
|
+
<%= vue_content_tag(:button, "Click me!", disabled: "!clickable") %>
|
141
|
+
<%= vue_content_tag(:button, "Click me!", "v-bind:disabled" => "!clickable") %>
|
142
|
+
```
|
143
|
+
|
144
|
+
If you want to add a normal attribute without `v-bind:` prefix,
|
145
|
+
specify `true` (boolean) to these keys:
|
146
|
+
|
147
|
+
```erb
|
148
|
+
<%= vue_content_tag(:button, "Click me!", disabled: true) %>
|
139
149
|
```
|
140
|
-
|
141
|
-
|
150
|
+
|
151
|
+
This line produces the following HTML fragment:
|
152
|
+
|
153
|
+
```html
|
154
|
+
<button disabled="disabled">Click me!</button>
|
142
155
|
```
|
143
156
|
|
157
|
+
|
144
158
|
### Vue.js directives
|
145
159
|
|
146
160
|
If the *HTML options* have one or more of the following keys
|
@@ -151,16 +165,16 @@ then, these keys get transformed by adding `v-` to their head.
|
|
151
165
|
|
152
166
|
In the example below, these two lines have the same result:
|
153
167
|
|
154
|
-
```
|
155
|
-
<%= vue_tag(:hr
|
156
|
-
<%= vue_tag(:hr, "v-if" => "itemsPresent")
|
168
|
+
```erb
|
169
|
+
<%= vue_tag(:hr, if: "itemsPresent") %>
|
170
|
+
<%= vue_tag(:hr, "v-if" => "itemsPresent") %>
|
157
171
|
```
|
158
172
|
|
159
173
|
Note that the `:else_if` key is transformed into the `v-else-if` directive:
|
160
174
|
|
161
|
-
```
|
162
|
-
<%= vue_tag(:hr, else_if: "itemsPresent")
|
163
|
-
<%= vue_tag(:hr, "v-else-if" => "itemsPresent")
|
175
|
+
```erb
|
176
|
+
<%= vue_tag(:hr, else_if: "itemsPresent") %>
|
177
|
+
<%= vue_tag(:hr, "v-else-if" => "itemsPresent") %>
|
164
178
|
```
|
165
179
|
|
166
180
|
### Extensions to the form building helpers
|
@@ -171,7 +185,7 @@ have these additional behavior.
|
|
171
185
|
|
172
186
|
Example:
|
173
187
|
|
174
|
-
```
|
188
|
+
```erb
|
175
189
|
<%= vue_form_for User.new do |f| %>
|
176
190
|
<%= f.text_field :name, model: "userName" %>
|
177
191
|
<label>
|
@@ -9,7 +9,8 @@ module VueFormFor
|
|
9
9
|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
10
10
|
def #{selector}(method, options = {})
|
11
11
|
resolve_vue_options(options)
|
12
|
-
|
12
|
+
namespace = @object_name.gsub(/\\[/, ".").gsub(/\\]/, "")
|
13
|
+
options[:"v-model"] ||= "\#{namespace}.\#{method}"
|
13
14
|
super(method, options)
|
14
15
|
end
|
15
16
|
RUBY_EVAL
|
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.3.
|
4
|
+
version: 0.3.2
|
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-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|