effective_datatables 4.8.0 → 4.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee +6 -1
- data/app/assets/stylesheets/dataTables/dataTables.bootstrap4.scss +1 -3
- data/app/helpers/effective_datatables_private_helper.rb +2 -0
- data/app/models/effective/effective_datatable/dsl/filters.rb +1 -1
- data/app/models/effective/effective_datatable/resource.rb +5 -6
- data/app/models/effective/effective_datatable/state.rb +1 -1
- data/app/views/effective/datatables/_active_storage_column.html.haml +1 -1
- data/config/effective_datatables.rb +1 -1
- data/lib/effective_datatables/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6a77322f8b3da0b36839982abeb4acf9d95dace45fbef7f5d6c070dfcf4a7b5
|
4
|
+
data.tar.gz: a577c815d43b2a7fac94a295608fb3c58b89498cdcf9a8786efcb1a914efcf1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b2c6a6ccd7736bf2acd6b6d3ea3fa413a39af920fc9d65243979ac5a354b2c861d15771f7c48b2f7e7ae9e12a7fb49b3852238f8705841a25969484871d9b7c
|
7
|
+
data.tar.gz: 6462f1def33b70d288dcf9fdded153b2e067b95df08a60d163ae81c5195eecceaa7e389bb8b02be4d2e0b368749a37dcc8c21ed74e9eadf8e1a26d0867f76f9d
|
@@ -5,6 +5,9 @@ initializeDataTables = (target) ->
|
|
5
5
|
buttons_export_columns = options['buttons_export_columns'] || ':not(.col-actions)'
|
6
6
|
reorder = datatable.data('reorder')
|
7
7
|
|
8
|
+
if datatable.data('inline') && datatable.closest('form').length > 0
|
9
|
+
console.error('inline datatable cannot work inside a form')
|
10
|
+
|
8
11
|
if options['buttons'] == false
|
9
12
|
options['buttons'] = []
|
10
13
|
|
@@ -172,7 +175,9 @@ initializeDataTables = (target) ->
|
|
172
175
|
|
173
176
|
value = $input.val()
|
174
177
|
|
175
|
-
if
|
178
|
+
if Array.isArray(value)
|
179
|
+
# Nothing
|
180
|
+
else if value.startsWith('"') && value.endsWith('"')
|
176
181
|
value = value.substring(1, value.length-1)
|
177
182
|
else
|
178
183
|
value = $.trim(value)
|
@@ -162,9 +162,7 @@ div.dataTables_scrollFoot > .dataTables_scrollFootInner > table {
|
|
162
162
|
text-align: center;
|
163
163
|
}
|
164
164
|
}
|
165
|
-
|
166
|
-
padding-right: 20px;
|
167
|
-
}
|
165
|
+
|
168
166
|
table.dataTable.table-sm .sorting:before,
|
169
167
|
table.dataTable.table-sm .sorting_asc:before,
|
170
168
|
table.dataTable.table-sm .sorting_desc:before {
|
@@ -149,6 +149,8 @@ module EffectiveDatatablesPrivateHelper
|
|
149
149
|
elsif as == :boolean
|
150
150
|
collection ||= [true, false].map { |value| [t("effective_datatables.boolean_#{value}"), value] }
|
151
151
|
form.public_send(:select, name, collection, options) # boolean
|
152
|
+
elsif as == :string
|
153
|
+
form.public_send(:text_field, name, options)
|
152
154
|
elsif form.respond_to?(as)
|
153
155
|
form.public_send(as, name, options) # check_box, text_area
|
154
156
|
else
|
@@ -4,7 +4,7 @@ module Effective
|
|
4
4
|
AGGREGATE_SQL_FUNCTIONS = ['ARRAY_AGG(', 'AVG(', 'COUNT(', 'MAX(', 'MIN(', 'STRING_AGG(', 'SUM(']
|
5
5
|
|
6
6
|
def admin_namespace?
|
7
|
-
|
7
|
+
[:admin, 'admin'].include?(controller_namespace)
|
8
8
|
end
|
9
9
|
|
10
10
|
def controller_namespace
|
@@ -200,6 +200,7 @@ module Effective
|
|
200
200
|
|
201
201
|
def load_resource_belongs_tos!
|
202
202
|
return unless active_record_collection?
|
203
|
+
return unless @_collection_apply_belongs_to
|
203
204
|
|
204
205
|
changed = attributes.select do |attribute, value|
|
205
206
|
attribute = attribute.to_s
|
@@ -210,7 +211,7 @@ module Effective
|
|
210
211
|
next unless columns[associated]
|
211
212
|
|
212
213
|
if columns[associated][:as] == :belongs_to
|
213
|
-
|
214
|
+
unless @_collection.where_values_hash.include?(attribute)
|
214
215
|
@_collection = @_collection.where(attribute => value)
|
215
216
|
end
|
216
217
|
|
@@ -218,10 +219,8 @@ module Effective
|
|
218
219
|
elsif columns[associated][:as] == :belongs_to_polymorphic
|
219
220
|
associated_type = attributes["#{associated}_type".to_sym] || raise("Expected #{associated}_type attribute to be present when #{associated}_id is present on a polymorphic belongs to")
|
220
221
|
|
221
|
-
|
222
|
-
|
223
|
-
@_collection = @_collection.where(attribute => value).where("#{associated}_type" => associated_type)
|
224
|
-
end
|
222
|
+
unless @_collection.where_values_hash.include?(attribute) || @_collection.where_values_hash.include?("#{associated}_type")
|
223
|
+
@_collection = @_collection.where(attribute => value).where("#{associated}_type" => associated_type)
|
225
224
|
end
|
226
225
|
|
227
226
|
columns.delete(associated)
|
@@ -198,7 +198,7 @@ module Effective
|
|
198
198
|
def parse_filter_value(filter, value)
|
199
199
|
return filter[:parse].call(value) if filter[:parse]
|
200
200
|
return nil if value.blank? && !filter[:required]
|
201
|
-
Effective::Attribute.new(filter[:value]).parse(value, name: filter[:name])
|
201
|
+
Effective::Attribute.new(filter[:as] || filter[:value] || :string).parse(value, name: filter[:name])
|
202
202
|
end
|
203
203
|
|
204
204
|
def cookie_state_params
|
@@ -1,4 +1,4 @@
|
|
1
1
|
- Array(resource.public_send(column[:name])).each do |file|
|
2
2
|
.col-resource_item
|
3
3
|
- title = [file.content_type, number_to_human_size(file.byte_size)].map(&:presence).compact
|
4
|
-
= link_to(file.filename, url_for(file), title: title)
|
4
|
+
= link_to(file.filename, url_for(file), title: title, target: '_blank')
|
@@ -35,7 +35,7 @@ EffectiveDatatables.setup do |config|
|
|
35
35
|
config.save_state = true
|
36
36
|
|
37
37
|
# Configure the _effective_dt cookie.
|
38
|
-
config.cookie_max_size =
|
38
|
+
config.cookie_max_size = 1500 # String size. Final byte size is about 1.5 times bigger, after rails signs it
|
39
39
|
config.cookie_domain = :all # Should usually be :all
|
40
40
|
config.cookie_tld_length = nil # Leave nil to autodetect, or set to probably 2
|
41
41
|
|
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.8.
|
4
|
+
version: 4.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -178,7 +178,7 @@ homepage: https://github.com/code-and-effect/effective_datatables
|
|
178
178
|
licenses:
|
179
179
|
- MIT
|
180
180
|
metadata: {}
|
181
|
-
post_install_message:
|
181
|
+
post_install_message:
|
182
182
|
rdoc_options: []
|
183
183
|
require_paths:
|
184
184
|
- lib
|
@@ -193,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
197
|
-
signing_key:
|
196
|
+
rubygems_version: 3.1.2
|
197
|
+
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord
|
200
200
|
or Array collection as well as post-rendered content displayed as a frontend jQuery
|