effective_datatables 3.4.6 → 3.4.7
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a74b101dbbefc858af2be72ba90a7da1c1ae83
|
4
|
+
data.tar.gz: db20682940371ddaeaa38848e8f6d2ce5a2af923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05357fff6a2f3859cf8a5b54cc9f08edf4ee60528ad28ef37d147355d48bb14a77a740775356f2e76b9b30a795ffe7c76550007cc4a8c61102c80ccb3069e3bc
|
7
|
+
data.tar.gz: 27ce01e01f8c9f6e593215cd8e2136ba8168b9f0662281ecfc962974a087a127cb68005d1504179cc35279d4e51ba63dc95c1e97829b829d21fd92be7f192b5b
|
@@ -2,6 +2,8 @@ module Effective
|
|
2
2
|
module EffectiveDatatable
|
3
3
|
module Format
|
4
4
|
BLANK = ''.freeze
|
5
|
+
SPACER = 'EFFECTIVEDATATABLESSPACER'.freeze
|
6
|
+
SPACER_TEMPLATE = '/effective/datatables/spacer_template'.freeze
|
5
7
|
|
6
8
|
private
|
7
9
|
|
@@ -11,11 +13,7 @@ module Effective
|
|
11
13
|
|
12
14
|
columns.each do |name, opts|
|
13
15
|
if opts[:partial] && state[:visible][name]
|
14
|
-
locals = {
|
15
|
-
datatable: self,
|
16
|
-
column: columns[name],
|
17
|
-
controller_namespace: controller_namespace
|
18
|
-
}.merge(resource_col_locals(opts))
|
16
|
+
locals = { datatable: self, column: columns[name] }.merge(resource_col_locals(opts))
|
19
17
|
|
20
18
|
rendered[name] = (view.render(
|
21
19
|
partial: opts[:partial],
|
@@ -23,9 +21,18 @@ module Effective
|
|
23
21
|
collection: collection.map { |row| row[opts[:index]] },
|
24
22
|
formats: :html,
|
25
23
|
locals: locals,
|
26
|
-
spacer_template:
|
27
|
-
) || '').split(
|
24
|
+
spacer_template: SPACER_TEMPLATE
|
25
|
+
) || '').split(SPACER)
|
26
|
+
elsif opts[:as] == :actions # This is default actions_col
|
27
|
+
locals = { datatable: self, column: columns[name], spacer_template: SPACER_TEMPLATE }
|
28
|
+
|
29
|
+
rendered[name] = (view.render_resource_actions(
|
30
|
+
resource,
|
31
|
+
collection.map { |row| row[opts[:index]] },
|
32
|
+
opts[:actions].merge(locals: locals)
|
33
|
+
) || '').split(SPACER)
|
28
34
|
end
|
35
|
+
|
29
36
|
end
|
30
37
|
|
31
38
|
collection.each_with_index do |row, row_index|
|
@@ -42,6 +49,8 @@ module Effective
|
|
42
49
|
dsl_tool.instance_exec(value, row, &opts[:format])
|
43
50
|
elsif opts[:partial]
|
44
51
|
rendered[name][row_index]
|
52
|
+
elsif opts[:as] == :actions
|
53
|
+
rendered[name][row_index]
|
45
54
|
else
|
46
55
|
format_column(value, opts)
|
47
56
|
end
|
@@ -102,14 +111,6 @@ module Effective
|
|
102
111
|
end
|
103
112
|
end
|
104
113
|
|
105
|
-
def actions_col_locals(opts)
|
106
|
-
if opts[:as] == :actions
|
107
|
-
{ actions_col_locals: opts[:actions].merge(effective_resource: resource) }
|
108
|
-
else
|
109
|
-
{}
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
114
|
def resource_col_locals(opts)
|
114
115
|
return {} unless (resource = opts[:resource]).present?
|
115
116
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_datatables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|