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 +4 -4
- data/app/helpers/effective_datatables_private_helper.rb +1 -1
- data/app/models/effective/datatable_column_tool.rb +1 -1
- data/app/models/effective/datatable_value_tool.rb +2 -0
- data/app/models/effective/effective_datatable/dsl/datatable.rb +1 -2
- data/app/models/effective/effective_datatable/format.rb +7 -3
- data/lib/effective_datatables/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aca73f243bfad0546f2a52be13aeb213efe11b646a60a79522553bed168661a6
|
4
|
+
data.tar.gz: 56729e4ab420c501524f05e543bdf49ddd64af4b0d11c054dd283f29add4042d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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,
|
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
|
-
|
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
|
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 }
|
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
|
+
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-
|
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.
|
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
|