bullet_train-fields 1.8.1 → 1.8.2

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: 075fa79828bbfed9f09902139083ff0ed2008ab73a59302b234a0a6c4bd315c4
4
- data.tar.gz: 746d46992d693c48d614dffa3de9367e2a8c737c4b510791c53bea203728ed8d
3
+ metadata.gz: 293eb19228b38b3ea231a3a7fbab301dabf209824f6e038c4fb8f1c83f0fa5eb
4
+ data.tar.gz: 2abf400571fd2b3478a6e56420136711ca48761a22b4d94f67b45ffe9c1e51b1
5
5
  SHA512:
6
- metadata.gz: 4446bdf2e45a24ac5cf379071d6281c1239560139275a1b46566dffd3820b9fe96932cdf32ea2f02eeb839154e55e037f115872d3d4a5629adfd4776920a57da
7
- data.tar.gz: cdb2e563e4154202f02c3ae488437f111c845132fcc6e1e840f1661fa34635e32eb1e2fa92d4aee7027c922972384c5272ae90432f77512d427cf78e90502ddb
6
+ metadata.gz: 1b11da4ab5bd28041c585d110e30df0b3110f49ae8fefce98fc5a08203a5bcdcf4f69e37c04ff889e6509978b2025edd061ed8c622e58f172a16339cde9094fd
7
+ data.tar.gz: 5c3209a6d15d9ba86d8c65f67995123fee529555dd16ee9fb6f74401dd4ea90abde95bf34b43188eabb3df048c56288295f7256b0ea5f247379b25162996dcea
@@ -5,7 +5,7 @@ module DependentFieldsFrameHelper
5
5
  new_value = new_value_from_query_string(field_name)
6
6
  return if new_value.nil?
7
7
 
8
- form.object[method] = new_value
8
+ form.object.send(:"#{method}=", new_value)
9
9
  end
10
10
 
11
11
  private
@@ -32,7 +32,7 @@ export default class extends Controller {
32
32
  }
33
33
 
34
34
  constructNewUrlUpdatingField(fieldName, fieldValue) {
35
- const url = new URL(window.location.href)
35
+ const url = new URL(this.currentUrl)
36
36
  url.searchParams.set(fieldName, fieldValue)
37
37
 
38
38
  return url.href
@@ -81,4 +81,9 @@ export default class extends Controller {
81
81
 
82
82
  field.value = value
83
83
  }
84
+
85
+ get currentUrl() {
86
+ const turboFrameWithUrl = this.element.closest("turbo-frame[src]")
87
+ return turboFrameWithUrl ? turboFrameWithUrl.src : window.location.href
88
+ }
84
89
  }
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.8.1"
3
+ VERSION = "1.8.2"
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.1
4
+ version: 1.8.2
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-10-30 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard