katalyst-tables 3.11.0 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e8456c713efa8b079198dff2fd156ba028258ff09eb056b6a9a95cc5eb1aeaf
|
|
4
|
+
data.tar.gz: 4f6045cabeecbb034134151167dae9e9ce1c0f8744e32576829665fde2ec9117
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b22f53a017c4e9120fab8d73fedc699d929c5ce855e659ce67cc20a592b27dd0400111ace41ddf0d0b5cc9646a5836263b82c564b3ed795fc2fff9b8137b7f61
|
|
7
|
+
data.tar.gz: 8bee047ee8e2ca64e849f8735a87f1f917ef4a83d757b9372d9be3e1f176a17de390ac0f57cab1140d967cc4dbc1c94496a9c5063bf68dc69cbbe5ddc6fd962e
|
|
@@ -3,18 +3,25 @@
|
|
|
3
3
|
module Katalyst
|
|
4
4
|
module Tables
|
|
5
5
|
module Collection
|
|
6
|
+
class Config
|
|
7
|
+
attr_accessor :paginate, :sorting
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
module Core # :nodoc:
|
|
7
11
|
extend ActiveSupport::Concern
|
|
8
12
|
|
|
9
13
|
include ActiveModel::Model
|
|
10
14
|
include ActiveModel::Attributes
|
|
11
15
|
include ActiveModel::Dirty
|
|
12
|
-
include ActiveSupport::Configurable
|
|
13
16
|
|
|
14
17
|
include HasParams
|
|
15
18
|
include Reducers
|
|
16
19
|
|
|
17
20
|
class_methods do
|
|
21
|
+
def config
|
|
22
|
+
@config ||= Config.new
|
|
23
|
+
end
|
|
24
|
+
|
|
18
25
|
def permitted_params
|
|
19
26
|
_default_attributes.to_h.each_with_object([]) do |(k, v), h|
|
|
20
27
|
h << case v
|
|
@@ -20,11 +20,9 @@ module Katalyst
|
|
|
20
20
|
attr_accessor :pagination
|
|
21
21
|
|
|
22
22
|
attribute :page, :integer, default: 1, filter: false
|
|
23
|
-
|
|
24
|
-
config_accessor :paginate
|
|
25
23
|
end
|
|
26
24
|
|
|
27
|
-
def initialize(paginate: config.paginate, **)
|
|
25
|
+
def initialize(paginate: self.class.config.paginate, **)
|
|
28
26
|
super(**)
|
|
29
27
|
|
|
30
28
|
@paginate = paginate.freeze
|
|
@@ -55,7 +55,7 @@ module Katalyst
|
|
|
55
55
|
attr_reader :default_sort
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
def initialize(sorting: config.sorting, **)
|
|
58
|
+
def initialize(sorting: self.class.config.sorting, **)
|
|
59
59
|
@default_sort = sorting.to_param if sorting.present?
|
|
60
60
|
|
|
61
61
|
super(sort: @default_sort, **) # set default sort based on config
|