effective_datatables 4.7.4 → 4.7.5
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 +4 -4
- data/app/models/effective/datatable.rb +2 -0
- data/app/models/effective/effective_datatable/compute.rb +1 -1
- data/app/models/effective/effective_datatable/dsl.rb +7 -2
- data/app/models/effective/effective_datatable/resource.rb +10 -2
- data/lib/effective_datatables/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48cac2f10a4ebc72966c0dfffbb2cfa813743d2bcc37ca2571e86252241d66ec
|
4
|
+
data.tar.gz: d7baf2ef61b1008ee0265c65bb3acb878c8da0d4031ea12cb4a27b000f54ef08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77eeca0bd8b7908e0fa6a893cb4cd96ab84c16bd235f520829c862104540861381af977ea017fd926608ea06620f43e935fd7af53a565321a7e00f52b66db54b
|
7
|
+
data.tar.gz: 42d1909524c35fc87fdd8495c5c28b84f93f8259b008a66d0a1037d1fc13f30e2efe86776f5fb5a35b2985b2bc32febdf14347e84abf9deed186810c19c16ea5
|
@@ -14,7 +14,7 @@ module Effective
|
|
14
14
|
@total_records = (active_record_collection? ? column_tool.size(col) : value_tool.size(col))
|
15
15
|
|
16
16
|
# Apply scope
|
17
|
-
col = column_tool.scope(col)
|
17
|
+
col = column_tool.scope(col) if @_collection_apply_scope
|
18
18
|
|
19
19
|
# Apply column searching
|
20
20
|
col = column_tool.search(col)
|
@@ -10,8 +10,13 @@ module Effective
|
|
10
10
|
define_method('initialize_charts') { dsl_tool.instance_exec(&block) }
|
11
11
|
end
|
12
12
|
|
13
|
-
def collection(&block)
|
14
|
-
define_method('initialize_collection') {
|
13
|
+
def collection(apply_belongs_to: true, apply_scope: true, &block)
|
14
|
+
define_method('initialize_collection') {
|
15
|
+
self._collection_apply_belongs_to = apply_belongs_to
|
16
|
+
self._collection_apply_scope = apply_scope
|
17
|
+
|
18
|
+
self._collection = dsl_tool.instance_exec(&block)
|
19
|
+
}
|
15
20
|
end
|
16
21
|
|
17
22
|
def datatable(&block)
|
@@ -180,12 +180,20 @@ module Effective
|
|
180
180
|
next unless columns[associated]
|
181
181
|
|
182
182
|
if columns[associated][:as] == :belongs_to
|
183
|
-
@
|
183
|
+
if @_collection_apply_belongs_to && !@_collection.where_values_hash.include?(attribute)
|
184
|
+
@_collection = @_collection.where(attribute => value)
|
185
|
+
end
|
186
|
+
|
184
187
|
columns.delete(associated)
|
185
188
|
elsif columns[associated][:as] == :belongs_to_polymorphic
|
186
189
|
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")
|
187
190
|
|
188
|
-
|
191
|
+
if @_collection_apply_belongs_to
|
192
|
+
if !@_collection.where_values_hash.include?(attribute) && !@_collection.where_values_hash.include?("#{associated}_type")
|
193
|
+
@_collection = @_collection.where(attribute => value).where("#{associated}_type" => associated_type)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
189
197
|
columns.delete(associated)
|
190
198
|
end
|
191
199
|
|
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.7.
|
4
|
+
version: 4.7.5
|
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: 2019-06-
|
11
|
+
date: 2019-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|