bullet_train-fields 1.7.20 → 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: 21eb5491e0ab33dd19e2afcf208b5151fba877890e1924204415cc532688fdba
4
- data.tar.gz: 99c4b038b466d932d1c384c2ba208add2f2890fd4c5c0a2f19371bf7956bce31
3
+ metadata.gz: 7ffe79887ec099d98e485ae14820bb0d8720b99ade4d4e35cb606a79f6bb3f6f
4
+ data.tar.gz: 1c1f8eb5bdcf5c69d32ae375b5ef10bdfa99cc2fd6496ee05f398b7a30df753c
5
5
  SHA512:
6
- metadata.gz: d091164bbbf1dc353ae4eebe0c96a0ed6c80000307b455b9536a5d7465f20392ca97d59af204ae0c730279174827c6083c0414e3a353ed11b3fe22b8b3aa1962
7
- data.tar.gz: 9e9325b2d52935007a80acb520df2eb8510af8658e6570a76ac84dc83df791c3ecee90de7a31acd08a748c1f370fbb90d9c102a3becbf511b9737b5458c6ff9b
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.value)
24
+ frame.src = this.constructNewUrlUpdatingField(field.name, this.getValueForField(field))
25
25
  }
26
26
 
27
27
  finishFrameUpdate(event) {
@@ -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.value
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.value = storedValue
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
  }
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.7.20"
3
+ VERSION = "1.7.22"
4
4
  end
5
5
  end
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.20
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-07-23 00:00:00.000000000 Z
11
+ date: 2024-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard