katalyst-tables 2.2.5 → 2.2.7

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: ce0864bc72a6abeb1e6d2060d278650cc6788c3afd87b5ab161ed1fafbeb91b6
4
- data.tar.gz: 668e674d96f58861e0a84e859c65dd3f9ad4ddd1c47f822f2d3a473b3b74709d
3
+ metadata.gz: 25c7348eb8542d2810e9448b6d966a21968e5906d9f520770687fce182455042
4
+ data.tar.gz: 1dffc5490373097ec0f03251e941336cf4cf06a5ae9542d8beae5fa6c33c4e32
5
5
  SHA512:
6
- metadata.gz: 42004d7e06b23581d04a0e7d381179fa550350d8221127fbd6d15dc9e8b40ff219246baa302e1379c6a7f02abfc3e2b7c955cae7eaa18c9890be7f0bfa60df10
7
- data.tar.gz: 066e394af2e31e1ebe060ed39fc67ecf9b80ad880a526c7ef1e233abb1116e9d4f16507fb89f800d755f2ffae7bad9aaeb4cd0ae4fb67724b86f46fa2eb16976
6
+ metadata.gz: 590ac1fd488278be25b6d6bc9cfcfa6b7d417d7390ca9a6c45fe3792f36c0c7b011662bc106b15972e100a528f36b3794704d33042f5efba89fd997e99d53386
7
+ data.tar.gz: 4051cacd2816958fe46b0c7d511b24f8a6d5ce3110cef45ba755953063ebdc05f3a36f99c2c514cf53f68703166e9bf0d9f6f4bae8360e7173f3044162bd9db9
@@ -21,9 +21,31 @@ module Katalyst
21
21
  %i[data action],
22
22
  ].freeze
23
23
 
24
+ FLATTENABLE_ATTRIBUTES = [
25
+ %i[data controller],
26
+ %i[data action],
27
+ ].freeze
28
+
29
+ refine NilClass do
30
+ def flatten_html(*)
31
+ self
32
+ end
33
+ end
34
+
24
35
  refine Hash do
25
36
  def merge_html(attributes)
26
- deep_merge_html_attributes(attributes, mergeable_attributes: MERGEABLE_ATTRIBUTES)
37
+ result = deep_merge_html_attributes(attributes, mergeable_attributes: MERGEABLE_ATTRIBUTES)
38
+ FLATTENABLE_ATTRIBUTES.each_with_object(result) do |path, flattened|
39
+ flattened.flatten_html(*path)
40
+ end
41
+ end
42
+
43
+ def flatten_html(key, *path)
44
+ if path.empty?
45
+ self[key] = self[key].join(" ") if self[key].is_a?(Array)
46
+ else
47
+ self[key].flatten_html(*path)
48
+ end
27
49
  end
28
50
  end
29
51
 
@@ -35,9 +35,7 @@ module Katalyst
35
35
 
36
36
  def current_path
37
37
  params = collection.to_params
38
- query_string = params.empty? ? "" : "?#{Rack::Utils.build_nested_query(params)}"
39
-
40
- "#{request.path}#{query_string}"
38
+ params.empty? ? "" : "?#{Rack::Utils.build_nested_query(params)}"
41
39
  end
42
40
 
43
41
  def default_header_options
@@ -15,7 +15,14 @@ module Katalyst
15
15
 
16
16
  class_methods do
17
17
  def permitted_params
18
- attribute_names
18
+ _default_attributes.to_h.each_with_object([]) do |(k, v), h|
19
+ h << case v
20
+ when Array
21
+ { k => [] }
22
+ else
23
+ k
24
+ end
25
+ end
19
26
  end
20
27
  end
21
28
 
@@ -37,7 +44,7 @@ module Katalyst
37
44
  end
38
45
 
39
46
  def filtered?
40
- !self.class.new.filters.eql?(filters)
47
+ self.class.new.filters != filters
41
48
  end
42
49
 
43
50
  def filters
@@ -27,7 +27,7 @@ module Katalyst
27
27
  def initialize(paginate: config.paginate, **options)
28
28
  super(**options)
29
29
 
30
- @paginate = paginate
30
+ @paginate = paginate.freeze
31
31
  end
32
32
 
33
33
  def paginate?
@@ -50,7 +50,7 @@ module Katalyst
50
50
  def call(collection)
51
51
  @collection = @app.call(collection)
52
52
  if collection.paginate?
53
- @collection.pagination, @collection.items = pagy(@collection.items, collection.paginate_options)
53
+ @collection.pagination, @collection.items = pagy(@collection.items, collection.paginate_options.dup)
54
54
  end
55
55
  @collection
56
56
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Katalyst
4
4
  module Tables
5
- VERSION = "2.2.5"
5
+ VERSION = "2.2.7"
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.5
4
+ version: 2.2.7
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-09-28 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils