effective_datatables 3.6.1 → 3.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 509cfa19dfd481e41030c2ba527e34b23b41fdd66485d53923317b43938e0f56
|
4
|
+
data.tar.gz: bfb1dcae3e580fcf1795290cbb543a68f741b2442484289b23f50c421ae98153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea2b82022025d623e56b0b2b5425b2161dcc7ae4d7697cf46d132ca9216c217a555cf53d30bc47af88323ceb9dfaac42dbf9e97753a9114fb1742709f60aab51
|
7
|
+
data.tar.gz: ee06ea290b341b2047676f5dd79de2165483f8522c05c6f438d920e94ddb85d9fef63ba4795c6539e10bfb6c7486db308597cdd87daa173358d2dcd7476103aa
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
class Datatable
|
3
3
|
attr_reader :attributes # Anything that we initialize our table with. That's it. Can't be changed by state.
|
4
|
-
attr_reader :
|
4
|
+
attr_reader :effective_resource
|
5
5
|
attr_reader :state
|
6
6
|
|
7
7
|
# Hashes of DSL options
|
@@ -149,6 +149,14 @@ module Effective
|
|
149
149
|
@dsl_tool ||= DatatableDslTool.new(self)
|
150
150
|
end
|
151
151
|
|
152
|
+
def resource
|
153
|
+
@effective_resource
|
154
|
+
end
|
155
|
+
|
156
|
+
def fallback_effective_resource
|
157
|
+
@fallback_effective_resource ||= Effective::Resource.new('', namespace: controller_namespace)
|
158
|
+
end
|
159
|
+
|
152
160
|
private
|
153
161
|
|
154
162
|
def column_tool
|
@@ -43,7 +43,7 @@ module Effective
|
|
43
43
|
Rails.logger.info "COLUMN TOOL: order_column #{column.to_s} #{direction} #{sql_column}" if EffectiveDatatables.debug
|
44
44
|
|
45
45
|
if column[:sql_as_column]
|
46
|
-
collection.order("#{sql_column} #{datatable.
|
46
|
+
collection.order("#{sql_column} #{datatable.effective_resource.sql_direction(direction)}")
|
47
47
|
else
|
48
48
|
Effective::Resource.new(collection)
|
49
49
|
.order(column[:name], direction, as: column[:as], sort: column[:sort], sql_column: column[:sql_column], limit: datatable.limit)
|
@@ -13,9 +13,15 @@ module Effective
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
+
def load_effective_resource!
|
17
|
+
@effective_resource = if active_record_collection?
|
18
|
+
Effective::Resource.new(collection_class, namespace: controller_namespace)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
16
22
|
# This looks at all the columns and figures out the as:
|
17
23
|
def load_resource!
|
18
|
-
|
24
|
+
load_effective_resource!
|
19
25
|
|
20
26
|
if active_record_collection?
|
21
27
|
columns.each do |name, opts|
|