formstrap 0.3.2 → 0.3.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7c89e02028fbd50ff04f97b36ad9ef3bcbc3a1e270d025a664a721a9755e7d
|
4
|
+
data.tar.gz: 2375b43a0db037bcb58be9bac12d47079d7f4e5baaa03b08a5ea839053a3aaad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c888b852f01b98134dae97d0a5573ac695c4525020a9fef792af903b9c7a894c5b85dce0172633246e78a0e5ed2825c89659ecf2ff2a663f5aea9b10d844002b
|
7
|
+
data.tar.gz: 30ae20de2ddf908f64a82ca167bbc62fa6c0c6b744403e48ff053a9b6e1f293a323f3070947f3d29dd5e4509ef7cee20d42ec9db18d76adb53c8eddb79ee65aa
|
@@ -126,12 +126,15 @@ export default class extends Controller {
|
|
126
126
|
const formData = new FormData()
|
127
127
|
|
128
128
|
// Replace all occurrences of "page[blocks_attributes][0]" with "block"
|
129
|
-
const regex = /\w+\[([^\]]+)s_attributes
|
129
|
+
const regex = /\w+\[([^\]]+)s_attributes]\[\d+]/g
|
130
130
|
const formElements = fields.querySelectorAll('input[name]:not([name$="[id]"]), select[name]:not([name$="[id]"]), textarea[name]:not([name$="[id]"]), button[name]:not([name$="[id]"])')
|
131
|
-
formElements.forEach(
|
131
|
+
formElements.forEach((element) => {
|
132
132
|
const currentName = element.getAttribute('name')
|
133
133
|
const newName = currentName.replace(regex, '$1')
|
134
|
-
|
134
|
+
const values = this.readValues(element)
|
135
|
+
values.forEach((value) => {
|
136
|
+
formData.append(newName, value)
|
137
|
+
})
|
135
138
|
})
|
136
139
|
|
137
140
|
// Add authenticity token
|
@@ -140,6 +143,15 @@ export default class extends Controller {
|
|
140
143
|
return formData
|
141
144
|
}
|
142
145
|
|
146
|
+
readValues (element) {
|
147
|
+
// Check if the element is a select with multiple selection
|
148
|
+
if (element.tagName.toLowerCase() === 'select' && element.multiple) {
|
149
|
+
return [...element.selectedOptions].map(option => option.value)
|
150
|
+
} else {
|
151
|
+
return [element.value]
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
143
155
|
// Prepare the iFrame for rendering
|
144
156
|
// Objective: render the iframe content at the scale of the browser window, but resize it to fit the preview container
|
145
157
|
prepareIframe () {
|
@@ -11380,16 +11380,26 @@ var nested_preview_controller_default = class extends Controller {
|
|
11380
11380
|
buildFormData() {
|
11381
11381
|
const fields = this.fieldsTarget;
|
11382
11382
|
const formData = new FormData();
|
11383
|
-
const regex = /\w+\[([^\]]+)s_attributes
|
11383
|
+
const regex = /\w+\[([^\]]+)s_attributes]\[\d+]/g;
|
11384
11384
|
const formElements = fields.querySelectorAll('input[name]:not([name$="[id]"]), select[name]:not([name$="[id]"]), textarea[name]:not([name$="[id]"]), button[name]:not([name$="[id]"])');
|
11385
|
-
formElements.forEach(
|
11385
|
+
formElements.forEach((element) => {
|
11386
11386
|
const currentName = element.getAttribute("name");
|
11387
11387
|
const newName = currentName.replace(regex, "$1");
|
11388
|
-
|
11388
|
+
const values = this.readValues(element);
|
11389
|
+
values.forEach((value) => {
|
11390
|
+
formData.append(newName, value);
|
11391
|
+
});
|
11389
11392
|
});
|
11390
11393
|
formData.append("authenticity_token", this.getAuthenticityToken());
|
11391
11394
|
return formData;
|
11392
11395
|
}
|
11396
|
+
readValues(element) {
|
11397
|
+
if (element.tagName.toLowerCase() === "select" && element.multiple) {
|
11398
|
+
return [...element.selectedOptions].map((option2) => option2.value);
|
11399
|
+
} else {
|
11400
|
+
return [element.value];
|
11401
|
+
}
|
11402
|
+
}
|
11393
11403
|
prepareIframe() {
|
11394
11404
|
const scaleFactor = this.scaleFactor();
|
11395
11405
|
const style = `
|
data/lib/formstrap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jef Vlamings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An extensive Bootstrap form library to power your Ruby On Rails application.
|
14
14
|
email:
|
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
213
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
214
|
+
rubygems_version: 3.5.6
|
215
215
|
signing_key:
|
216
216
|
specification_version: 4
|
217
217
|
summary: Bootstrap-powered Form Helpers
|