effective_datatables 3.5.0 → 3.5.2
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: 9cd68beee734d563dfcd4ee9535e01aee6d121b3
|
4
|
+
data.tar.gz: 75255066db9a98a9da9d18534c402202670f84c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae954fd101983c833afc51e9ce27db3f92b904390ff26312b9bb4a791ea470bb49966f0a480c5111993ffea3999d897bf9f20b1fca67724c69ee5cc80e844339
|
7
|
+
data.tar.gz: 77de12778528a1d10fc9658d17e04cdacb74b6e16901df219f922a9522d579025c30fac329374272565499176131df3834e4832e71cd9e9b0fd3606641ef98a5
|
@@ -2,6 +2,7 @@ module Effective
|
|
2
2
|
module EffectiveDatatable
|
3
3
|
module Format
|
4
4
|
BLANK = ''.freeze
|
5
|
+
NONVISIBLE = '...'.freeze
|
5
6
|
SPACER = 'EFFECTIVEDATATABLESSPACER'.freeze
|
6
7
|
SPACER_TEMPLATE = '/effective/datatables/spacer_template'.freeze
|
7
8
|
|
@@ -12,7 +13,9 @@ module Effective
|
|
12
13
|
rendered = {}
|
13
14
|
|
14
15
|
columns.each do |name, opts|
|
15
|
-
|
16
|
+
next unless state[:visible][name]
|
17
|
+
|
18
|
+
if opts[:partial]
|
16
19
|
locals = { datatable: self, column: columns[name] }.merge(resource_col_locals(opts))
|
17
20
|
|
18
21
|
rendered[name] = (view.render(
|
@@ -24,10 +27,9 @@ module Effective
|
|
24
27
|
spacer_template: SPACER_TEMPLATE
|
25
28
|
) || '').split(SPACER)
|
26
29
|
elsif opts[:as] == :actions # This is actions_col and actions_col do .. end, but not actions_col partial: 'something'
|
27
|
-
locals = { datatable: self, column: columns[name], spacer_template: SPACER_TEMPLATE }
|
28
|
-
|
29
30
|
resources = collection.map { |row| row[opts[:index]] }
|
30
|
-
|
31
|
+
locals = { datatable: self, column: opts, spacer_template: SPACER_TEMPLATE }
|
32
|
+
atts = { actions: actions_col_actions(opts), effective_resource: resource, locals: locals, partial: opts[:actions_partial] }.merge(opts[:actions])
|
31
33
|
|
32
34
|
rendered[name] = (view.render_resource_actions(resources, atts, &opts[:format]) || '').split(SPACER)
|
33
35
|
end
|
@@ -36,13 +38,13 @@ module Effective
|
|
36
38
|
|
37
39
|
collection.each_with_index do |row, row_index|
|
38
40
|
columns.each do |name, opts|
|
39
|
-
next unless state[:visible][name]
|
40
|
-
|
41
41
|
index = opts[:index]
|
42
42
|
value = row[index]
|
43
43
|
|
44
44
|
row[index] = (
|
45
|
-
if
|
45
|
+
if state[:visible][name] == false
|
46
|
+
NONVISIBLE
|
47
|
+
elsif opts[:as] == :actions
|
46
48
|
rendered[name][row_index]
|
47
49
|
elsif opts[:format] && rendered.key?(name)
|
48
50
|
dsl_tool.instance_exec(value, row, rendered[name][row_index], &opts[:format])
|
@@ -67,7 +69,8 @@ module Effective
|
|
67
69
|
|
68
70
|
case column[:as]
|
69
71
|
when :actions
|
70
|
-
|
72
|
+
atts = { actions: actions_col_actions(column), effective_resource: resource, partial: column[:actions_partial] }.merge(column[:actions])
|
73
|
+
(view.render_resource_actions(value, atts) || '')
|
71
74
|
when :boolean
|
72
75
|
case value
|
73
76
|
when true ; 'Yes'
|
@@ -110,6 +113,12 @@ module Effective
|
|
110
113
|
end
|
111
114
|
end
|
112
115
|
|
116
|
+
# Takes all default resource actions
|
117
|
+
# Applies data-remote to anything that's data-method post or delete
|
118
|
+
def actions_col_actions(column)
|
119
|
+
resource.resource_actions
|
120
|
+
end
|
121
|
+
|
113
122
|
def resource_col_locals(opts)
|
114
123
|
return {} unless (resource = opts[:resource]).present?
|
115
124
|
|
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.5.
|
4
|
+
version: 3.5.2
|
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-
|
11
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
182
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.5.
|
183
|
+
rubygems_version: 2.4.5.1
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord
|