bullet_train-fields 1.7.21 → 1.7.22
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: 7ffe79887ec099d98e485ae14820bb0d8720b99ade4d4e35cb606a79f6bb3f6f
|
4
|
+
data.tar.gz: 1c1f8eb5bdcf5c69d32ae375b5ef10bdfa99cc2fd6496ee05f398b7a30df753c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 282a17d2aceede717184e349a2af4d8a24fbecf339429593d7d18e3d5662da04bd7fa79cf4d6b656d361a32e5fee87b9782c4ab9545f7effe0e7070af1707800
|
7
|
+
data.tar.gz: eda4dbb76391000a16e7b83c1225c3dbfb09b29d4c79ea9596e2569132cbbd1683386fae9ad725013b0ebc1cd2d6bf05436a3ee863641f4d8f7ee686ddfaec65
|
@@ -21,7 +21,7 @@ export default class extends Controller {
|
|
21
21
|
this.disableFieldInputWhileRefreshing()
|
22
22
|
|
23
23
|
const frame = this.element
|
24
|
-
frame.src = this.constructNewUrlUpdatingField(field.name, field
|
24
|
+
frame.src = this.constructNewUrlUpdatingField(field.name, this.getValueForField(field))
|
25
25
|
}
|
26
26
|
|
27
27
|
finishFrameUpdate(event) {
|
@@ -32,7 +32,7 @@ export default class extends Controller {
|
|
32
32
|
}
|
33
33
|
|
34
34
|
constructNewUrlUpdatingField(fieldName, fieldValue) {
|
35
|
-
const url = new URL(
|
35
|
+
const url = new URL(window.location.href)
|
36
36
|
url.searchParams.set(fieldName, fieldValue)
|
37
37
|
|
38
38
|
return url.href
|
@@ -50,7 +50,7 @@ export default class extends Controller {
|
|
50
50
|
storeFieldValues() {
|
51
51
|
this.fieldTargets.forEach(field => {
|
52
52
|
let storeUpdate = {}
|
53
|
-
storeUpdate[field.name] = field
|
53
|
+
storeUpdate[field.name] = this.getValueForField(field)
|
54
54
|
this.valuesStoreValue = Object.assign(this.valuesStoreValue, storeUpdate)
|
55
55
|
})
|
56
56
|
}
|
@@ -59,10 +59,26 @@ export default class extends Controller {
|
|
59
59
|
this.fieldTargets.forEach(field => {
|
60
60
|
const storedValue = this.valuesStoreValue[field.name]
|
61
61
|
if (storedValue === undefined) { return }
|
62
|
-
field
|
62
|
+
this.setValueForField(field, storedValue)
|
63
63
|
field.dispatchEvent(new Event('change')) // ensures cascading effects, including super-select validating against valid options
|
64
64
|
})
|
65
65
|
|
66
66
|
this.valuesStoreValue = {}
|
67
67
|
}
|
68
|
+
|
69
|
+
getValueForField(field) {
|
70
|
+
if (field.type === "checkbox") {
|
71
|
+
return field.checked
|
72
|
+
}
|
73
|
+
|
74
|
+
return field.value
|
75
|
+
}
|
76
|
+
|
77
|
+
setValueForField(field, value) {
|
78
|
+
if (field.type === "checkbox") {
|
79
|
+
field.checked = value
|
80
|
+
}
|
81
|
+
|
82
|
+
field.value = value
|
83
|
+
}
|
68
84
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|