effective_datatables 3.4.6 → 3.4.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
  SHA1:
3
- metadata.gz: 7e0817076dc8c820589f2b05dd96ec11336d8030
4
- data.tar.gz: df5e3e636888dcfba0564198af6c41a5362cae58
3
+ metadata.gz: e7a74b101dbbefc858af2be72ba90a7da1c1ae83
4
+ data.tar.gz: db20682940371ddaeaa38848e8f6d2ce5a2af923
5
5
  SHA512:
6
- metadata.gz: 358b869727ff329401ded969fe6f850e7d72240fc66face9ae2418ad94979b00dacfc82bbc76cfd09a6365e680b979f1b1a77f0673ac72637b7170cf2e413423
7
- data.tar.gz: 6128c9177de0251b1445f1b6ceee2a4ff656dc787cebf08a4c29badfe4251c85ea496e7bf09d40982bce22c2f38d6ca055cf88f33587f3af078780984c0a4134
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: '/effective/datatables/spacer_template',
27
- ) || '').split('EFFECTIVEDATATABLESSPACER')
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '3.4.6'.freeze
2
+ VERSION = '3.4.7'.freeze
3
3
  end
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.6
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-12 00:00:00.000000000 Z
11
+ date: 2018-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails