katalyst-tables 2.2.8 → 2.2.10

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: 912bbde0db12fa0f5a6c6eda7958273f2d0b3efe4476d407ee19b6e6abb3abd1
4
- data.tar.gz: a065eaa897a541fdf08e257d17147206b38e1af2f92cc1ce508f6be19de60acb
3
+ metadata.gz: d3e58b95b2dc1f01bdd97fd36a31b2f340d93928d939a7501b58e7fd96150571
4
+ data.tar.gz: a72ece66c7770865d2b5892b83d114a9fa90afc5d1f81751ea37be6c34406077
5
5
  SHA512:
6
- metadata.gz: 7d3ed117d5cf77f50674fe097d2979fa19253965e2ac14104637eb503c38c80f087f3c05eb7f87df25336b61a380ae541fa35e037bf9923cf38bb393cd38d7a9
7
- data.tar.gz: 96a3adcfb05be7dd131e68f5851fe960d92d2d57ed07bf0d2bbf9f571ae6a26a47f213ee2e2567baa2f478f267d53a61dcf29e4c1d331057ccd9bbcf7af99e05
6
+ metadata.gz: e353837d14ec65ca9391a5190615c8696d39a0b46a4099f5c4563b28963b0cd338eaf70d48187a485fbf2a747ed64d11d296da8805f3c4008ae4e02bbeacc768
7
+ data.tar.gz: 0d3837526230b4f95f9a1c235d6377c112b5d2edb820b0b56ca9f621c72a0019b735d206f9d39002340b1ce93c7efd3674013dbb1c96073d306c785562b4ad7c
@@ -1,14 +1,14 @@
1
1
  import { Controller } from "@hotwired/stimulus";
2
- import { Turbo } from "@hotwired/turbo";
2
+ import { Turbo } from "@hotwired/turbo-rails";
3
3
 
4
4
  export default class TurboCollectionController extends Controller {
5
5
  static values = {
6
- url: String,
6
+ query: String,
7
7
  sort: String,
8
8
  };
9
9
 
10
- urlValueChanged(url) {
11
- Turbo.navigator.history.replace(this.#url(url));
10
+ queryValueChanged(query) {
11
+ Turbo.navigator.history.replace(this.#url(query));
12
12
  }
13
13
 
14
14
  sortValueChanged(sort) {
@@ -21,13 +21,18 @@ export default class TurboCollectionController extends Controller {
21
21
  return "input[name='sort']";
22
22
  }
23
23
 
24
- #url(relativeUrl) {
24
+ #url(query) {
25
25
  const frame = this.element.closest("turbo-frame");
26
+ let url;
26
27
 
27
28
  if (frame) {
28
- return new URL(relativeUrl, frame.baseURI);
29
+ url = new URL(frame.baseURI);
29
30
  } else {
30
- return new URL(relativeUrl, window.location.href);
31
+ url = new URL(window.location.href);
31
32
  }
33
+
34
+ url.search = query;
35
+
36
+ return url;
32
37
  }
33
38
  }
@@ -26,16 +26,15 @@ module Katalyst
26
26
  def default_html_attributes
27
27
  {
28
28
  data: {
29
- controller: "tables--turbo-collection",
30
- tables__turbo_collection_url_value: current_path,
31
- tables__turbo_collection_sort_value: collection.sort,
29
+ controller: "tables--turbo-collection",
30
+ tables__turbo_collection_query_value: current_query,
31
+ tables__turbo_collection_sort_value: collection.sort,
32
32
  },
33
33
  }
34
34
  end
35
35
 
36
- def current_path
37
- params = collection.to_params
38
- params.empty? ? "" : "?#{Rack::Utils.build_nested_query(params)}"
36
+ def current_query
37
+ Rack::Utils.build_nested_query(collection.to_params)
39
38
  end
40
39
 
41
40
  def default_header_options
data/config/importmap.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
4
- pin "@hotwired/turbo", to: "turbo.min.js", preload: true
5
-
6
3
  pin_all_from Katalyst::Tables::Engine.root.join("app/assets/javascripts"),
7
4
  # preload in tests so that we don't start clicking before controllers load
8
5
  preload: Rails.env.test?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Katalyst
4
4
  module Tables
5
- VERSION = "2.2.8"
5
+ VERSION = "2.2.10"
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.2.8
4
+ version: 2.2.10
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-11-06 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils