effective_datatables 4.10.3 → 4.10.6

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
  SHA256:
3
- metadata.gz: f8fa23825496c27d779457c70827727371d84aeb953b674226d2218d1279555c
4
- data.tar.gz: dd26ea781b3b09883ee67d156e9407de85400beb0573edb6c98ee782740762cb
3
+ metadata.gz: b8b4404aa7ed71091b5136e13f24348b67a2d591933b386a7f7a3d47c698cbd0
4
+ data.tar.gz: d0bfa93d8b63174ed043cd4cb4de596c49b51dccd75cb00d1e56a7d7753522a9
5
5
  SHA512:
6
- metadata.gz: 5872f805495f9cffcb1e6a41b56671092b0e2a6337d23bc85fb6db5bd90e772dd311c2fb65e21d46fdc42f126906e2b7e7902bef902a1cae6591cb963249e5cc
7
- data.tar.gz: ceffdf55902c85e2fc8ab99638add52750f9ae09a3fb6e48a284e6db49592cdedae6dca29544486316e96febb5606bfdfcbca015f2fe887aaf5f09b5f96b3a9c
6
+ metadata.gz: 645fd35fd30ad091d3a11e159b670a3def7e7f08d20af6646025f7d961214b8a995599dc824142378b4e97fe7c79eae02aed9db54e7d1081266c66c8350ea373
7
+ data.tar.gz: d4aa64b1d27c777537df67803031c194a764af723afa99fb34111f9f5f7bda9205530db9a4ca030dffaae99675fc653a116b6cbb937f1547f107f10676f976d3
@@ -62,6 +62,7 @@ module EffectiveDatatablesHelper
62
62
  'inline' => inline.to_s,
63
63
  'language' => EffectiveDatatables.language(I18n.locale),
64
64
  'options' => input_js.to_json,
65
+ 'reorder' => datatable.reorder?.to_s,
65
66
  'reorder-index' => (datatable.columns[:_reorder][:index] if datatable.reorder?).to_s,
66
67
  'simple' => simple.to_s,
67
68
  'spinner' => icon('spinner'), # effective_bootstrap
@@ -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
 
@@ -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.3'.freeze
2
+ VERSION = '4.10.6'.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.3
4
+ version: 4.10.6
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: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails