katalyst-tables 2.1.2 → 2.1.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: ddd6b87989959fe3bea80d3d061984ace8fbaa918033ae6d40f1fb41fa752a4f
4
- data.tar.gz: c1fcff810e0c6e76ae8ae8df7a92f26d0badd1601b6fd091748249eaeebdc262
3
+ metadata.gz: 5f13db4214a34d37ef3f5cdc1ce35b92d89102f627be22b31794496dad2ca4a7
4
+ data.tar.gz: 0d6f8dd7971eab72d20d3d1438e75daaf61ae1029c170e77653570312b07e150
5
5
  SHA512:
6
- metadata.gz: 39a50df893890ed53a0d54acc7ab5d23a0292c9e98ec82b4e6286325713e115d718cfcdaf8caf6c0b2ce211ec20ea514eb53b5dc275dfe04bf253ee00d094aa5
7
- data.tar.gz: 919db4197193d5c4d2be8ea6c15642ff309819757c32ae6cb99266412029e0d250156220584442d048b97a40bcc9c5cce7660d141ac9fb157d12d8468b6fd268
6
+ metadata.gz: c3bc64f42389475a49357b0c30236e854a8be2bcc81034d5be4a085a7e5bba54668ac7f0231ab55f8d63feb902620fb9019c9c1040f3422e5d0fd85512102abc
7
+ data.tar.gz: '09dcc5204e076d9e3e2e6d406d884b23d7bd3e8495bf3d8a6f4dfeb47c6d2109b4e8688d85de884d44d18f3cbe0c3696ce50bce8d0189ed45686c0f87c1e48fd'
@@ -1,4 +1,5 @@
1
1
  import { Controller } from "@hotwired/stimulus";
2
+ import { Turbo } from "@hotwired/turbo";
2
3
 
3
4
  export default class TurboCollectionController extends Controller {
4
5
  static values = {
@@ -7,7 +8,7 @@ export default class TurboCollectionController extends Controller {
7
8
  }
8
9
 
9
10
  urlValueChanged(url) {
10
- window.history.replaceState({}, "", this.urlValue);
11
+ Turbo.navigator.history.replace(this.#url(url));
11
12
  }
12
13
 
13
14
  sortValueChanged(sort) {
@@ -19,4 +20,14 @@ export default class TurboCollectionController extends Controller {
19
20
  get #sortSelector() {
20
21
  return "input[name='sort']";
21
22
  }
23
+
24
+ #url(relativeUrl) {
25
+ const frame = this.element.closest("turbo-frame");
26
+
27
+ if (frame) {
28
+ return new URL(relativeUrl, frame.baseURI);
29
+ } else {
30
+ return new URL(relativeUrl, window.location.href);
31
+ }
32
+ }
22
33
  }
data/config/importmap.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
4
+ pin "@hotwired/turbo", to: "turbo.min.js", preload: true
4
5
 
5
6
  pin_all_from Katalyst::Tables::Engine.root.join("app/assets/javascripts"),
6
7
  # preload in tests so that we don't start clicking before controllers load
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Katalyst
4
4
  module Tables
5
- VERSION = "2.1.2"
5
+ VERSION = "2.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-27 00:00:00.000000000 Z
11
+ date: 2023-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils