effective_datatables 4.10.4 → 4.10.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
  SHA256:
3
- metadata.gz: c52636b5c1ed7d99254c4a3ffeac60a3e85edb190ca2321783f75ad6a5824298
4
- data.tar.gz: 6c7681d656c2903bb55601b0168bf9973c17dee21f0118030dcb534e83d3ade7
3
+ metadata.gz: aca73f243bfad0546f2a52be13aeb213efe11b646a60a79522553bed168661a6
4
+ data.tar.gz: 56729e4ab420c501524f05e543bdf49ddd64af4b0d11c054dd283f29add4042d
5
5
  SHA512:
6
- metadata.gz: 1e792d9737426b30211fd7e0810f8021d404149be1b47587c49799fa0090e41529a52a2736d07a7a8b593d8d325d325f00f2613372c40eb7cf08ee7759f553a7
7
- data.tar.gz: 21da5721c55fe36fe9c232cc045e8b6f1ba72a13d7f275e03ed1dc8c7eac952f4d13cbcf9b4b081ddc05b70e508cc6ecf61d35259e17f1c65089d956b9457c52
6
+ metadata.gz: e894dd4994ed0803c0011e39e8d12cd38272205cfdcee296c52d631309fcf6a2444e6928fea0a227a453d28697b6744283d7db75771942447f687672a59ba64b
7
+ data.tar.gz: 205255688bb9334fb632bfdf1a52a81d8534463d82dc4ad62cec670f2ef91eba620ae63ba031cc1da6b1079a54cf64bacd19d4392ffafde24c11457dfbfd3bfb
@@ -30,7 +30,7 @@ module EffectiveDatatablesPrivateHelper
30
30
  end
31
31
 
32
32
  def datatable_new_resource_button(datatable, name, column)
33
- return unless column[:inline] && (column[:actions][:new] != false)
33
+ return unless datatable.inline? && (column[:actions][:new] != false)
34
34
 
35
35
  action = { action: :new, class: ['btn', column[:btn_class].presence].compact.join(' '), 'data-remote': true }
36
36
 
@@ -45,7 +45,7 @@ module Effective
45
45
  Rails.logger.info "COLUMN TOOL: order_column #{column.to_s} #{direction} #{sql_column}" if EffectiveDatatables.debug
46
46
 
47
47
  if column[:sql_as_column]
48
- collection.order("#{sql_column} #{datatable.effective_resource.sql_direction(direction)}")
48
+ collection.order(Arel.sql("#{sql_column} #{datatable.effective_resource.sql_direction(direction)}"))
49
49
  else
50
50
  Effective::Resource.new(collection)
51
51
  .order(column[:name], direction, as: column[:as], sort: column[:sort], sql_column: column[:sql_column], limit: datatable.limit)
@@ -176,6 +176,8 @@ module Effective
176
176
 
177
177
  if column[:format]
178
178
  datatable.dsl_tool.instance_exec(obj, row, &column[:format])
179
+ elsif column[:as] == :belongs_to_polymorphic
180
+ obj.send(column[:name]).to_s
179
181
  elsif column[:partial]
180
182
  obj.to_s
181
183
  elsif obj.respond_to?(column[:name])
@@ -90,7 +90,7 @@ module Effective
90
90
  )
91
91
  end
92
92
 
93
- def actions_col(btn_class: nil, col_class: nil, inline: nil, partial: nil, partial_as: nil, actions_partial: nil, responsive: 5000, visible: true, **actions, &format)
93
+ def actions_col(btn_class: nil, col_class: nil, partial: nil, partial_as: nil, actions_partial: nil, responsive: 5000, visible: true, **actions, &format)
94
94
  raise 'You can only have one actions column' if datatable.columns[:_actions].present?
95
95
 
96
96
  datatable._columns[:_actions] = Effective::DatatableColumn.new(
@@ -102,7 +102,6 @@ module Effective
102
102
  csv: false,
103
103
  format: (format if block_given?),
104
104
  index: nil,
105
- inline: (inline.nil? ? datatable.inline? : inline),
106
105
  label: false,
107
106
  name: :actions,
108
107
  partial: partial,
@@ -96,7 +96,11 @@ module Effective
96
96
  end
97
97
 
98
98
  if value.kind_of?(Array) && column[:as] == :string
99
- return value.map { |v| view.content_tag(:div, format_column(v, column, csv: csv), class: 'col-resource_item') }.join.html_safe
99
+ if csv
100
+ return value.map { |v| format_column(v, column, csv: csv) }.join("\n")
101
+ else
102
+ return value.map { |v| view.content_tag(:div, format_column(v, column, csv: csv), class: 'col-resource_item') }.join.html_safe
103
+ end
100
104
  end
101
105
 
102
106
  case column[:as]
@@ -119,7 +123,7 @@ module Effective
119
123
  when :duration
120
124
  view.number_to_duration(value)
121
125
  when :effective_addresses
122
- value.to_html
126
+ csv ? value.to_html.gsub('<br>', "\n") : value.to_html
123
127
  when :effective_obfuscation
124
128
  value
125
129
  when :effective_roles
@@ -151,7 +155,7 @@ module Effective
151
155
  def actions_col_actions(column)
152
156
  resource_actions = (effective_resource&.resource_actions || fallback_effective_resource.fallback_resource_actions)
153
157
 
154
- actions = if column[:inline]
158
+ actions = if inline?
155
159
  resource_actions.transform_values { |opts| opts['data-remote'] = true; opts }
156
160
  else
157
161
  resource_actions.transform_values { |opts| opts['data-remote'] = true if opts['data-method']; opts }
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '4.10.4'.freeze
2
+ VERSION = '4.10.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: 4.10.4
4
+ version: 4.10.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: 2022-01-03 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.1.2
196
+ rubygems_version: 3.1.6
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord