bullet_train-fields 1.8.4 → 1.8.5

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: 65fae7a71e7f8921d63cf9f2de8070a19efdbb2cd3c12565862cc7250b8139c9
4
- data.tar.gz: 3faae5a09e1034aded6f3e3aa3f2ff82bb45dffefdaa82fac1e465b72c61cce0
3
+ metadata.gz: f13952cec1ba63c8ad7fff90e281492b9002f13c69b8bf290bc73f2ccfd4f2cf
4
+ data.tar.gz: d0870184fb0f4fc34e34751c24e1f141ac42b65a74195227ef42e2fc5db1266c
5
5
  SHA512:
6
- metadata.gz: 9ce62e2ad78e351c63928c6c4fbdb07b50281c4a999cddd0579791b821d3d3b4a20153bf58f5d84ae6d1e28280325936006e1386891352bf9f54abc13e9067a8
7
- data.tar.gz: d78364958922b1e2be0dbffbebe7e7b2e912e1fda5384c90c87d76aacf1934e6ed1a5b78f40d568a70ccefc068b67275583b9e11e3e16cc829c11a0e724871c4
6
+ metadata.gz: 9ab3d5ad358e123764acca7e3dcac34301e4c59043d5ff9fc4d40d96b90b56f962368e2bb154d333294862e92d150992028ae47b8187a51728665d2ff38fda19
7
+ data.tar.gz: 4554dcdcf115f9e8afbaf9fe181a9e2679316c111b5445588a75d5915578ceb119a9550a242623fa927dd3f58e6011108ee4e2cb0e4817b49ccdf838cc831924
@@ -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, this.getValueForField(field))
24
+ frame.src = this.constructNewUrlUpdatingField(field)
25
25
  }
26
26
 
27
27
  finishFrameUpdate(event) {
@@ -31,9 +31,19 @@ export default class extends Controller {
31
31
  this.loadingValue = false
32
32
  }
33
33
 
34
- constructNewUrlUpdatingField(fieldName, fieldValue) {
34
+ constructNewUrlUpdatingField(field) {
35
35
  const url = new URL(this.currentUrl)
36
- url.searchParams.set(fieldName, fieldValue)
36
+ const form = field.form
37
+ const formData = form ? new FormData(form) : {}
38
+
39
+ if ((field.type === "checkbox" || field.type === "select-multiple") && field.name.endsWith("[]")) {
40
+ url.searchParams.delete(field.name)
41
+ formData.getAll(field.name).forEach(value => {
42
+ url.searchParams.append(field.name, value)
43
+ })
44
+ } else {
45
+ url.searchParams.set(field.name, this.getValueForField(field))
46
+ }
37
47
 
38
48
  return url.href
39
49
  }
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.8.4"
3
+ VERSION = "1.8.5"
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.8.4
4
+ version: 1.8.5
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-15 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard