effective_datatables 4.7.19 → 4.7.20
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64b15bd9c60e95f6097c087680780efc353785339a872b303214ba5bfe7f0b4d
|
4
|
+
data.tar.gz: c60b68831df53a2b8e4d14684313f8c62b2a7dce346209358492d0276aa39804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b816c9a553c6c984f579728363208abbd686adc4ac649dba3c8b2315d1ae0af2a361ce272266bceed88bc732e17bc092f7f1c26359eed861fa97c4b5a806eac0
|
7
|
+
data.tar.gz: 402548a22f0e10a00915eedf2c6f3e2d8847d6010b9a23b1cfa3633c2f297d25f8aa7e99c2ec229c910478da10f72f1b225c8ae93113cd669962a6139dcab4ed
|
data/README.md
CHANGED
@@ -879,6 +879,10 @@ Create a [Google Chart](https://developers.google.com/chart/interactive/docs/qui
|
|
879
879
|
|
880
880
|
No javascript required. Just use the `chart do ... end` block and return an Array of Arrays.
|
881
881
|
|
882
|
+
The first collection, `collection` is the raw results as returned from the `collection do` block.
|
883
|
+
|
884
|
+
The second collection, `searched_collection` is the results after the table's search columns have been applied, but irregardless of pagination.
|
885
|
+
|
882
886
|
```ruby
|
883
887
|
charts do
|
884
888
|
chart :breakfast, 'BarChart' do |collection|
|
@@ -894,6 +898,18 @@ charts do
|
|
894
898
|
[date.strftime('%F'), posts.length]
|
895
899
|
end
|
896
900
|
end
|
901
|
+
|
902
|
+
chart :posts_per_user, 'ColumnChart' do |collection, searched_collection|
|
903
|
+
measured_posts = if search.present?
|
904
|
+
["Posts with #{search.map { |k, v| k.to_s + ' ' + v.to_s }.join(',')}", searched_collection.length]
|
905
|
+
else
|
906
|
+
['All Posts', collection.length]
|
907
|
+
end
|
908
|
+
|
909
|
+
[['Posts', 'Count'], measured_posts] +
|
910
|
+
searched_collection.group_by(&:user).map { |user, posts| [user.last_name, posts.length] }
|
911
|
+
end
|
912
|
+
|
897
913
|
end
|
898
914
|
```
|
899
915
|
|
@@ -131,7 +131,7 @@ initializeDataTables = (target) ->
|
|
131
131
|
if typeof(google) != 'undefined' && typeof(google.visualization) != 'undefined'
|
132
132
|
$.each charts, (name, data) =>
|
133
133
|
$(".effective-datatables-chart[data-name='#{name}']").each (_, obj) =>
|
134
|
-
chart = new google.visualization[data['
|
134
|
+
chart = new google.visualization[data['as']](obj)
|
135
135
|
chart.draw(google.visualization.arrayToDataTable(data['data']), data['options'])
|
136
136
|
|
137
137
|
# Appends the search html, stored in the column definitions, into each column header
|
@@ -36,6 +36,9 @@ module Effective
|
|
36
36
|
# Apply value ordering
|
37
37
|
col = value_tool.order(col)
|
38
38
|
|
39
|
+
# Charts too
|
40
|
+
@charts_data = chart(collection, col) if _charts.present?
|
41
|
+
|
39
42
|
# Apply pagination
|
40
43
|
col = col.kind_of?(Array) ? value_tool.paginate(col) : column_tool.paginate(col)
|
41
44
|
|
@@ -48,9 +51,6 @@ module Effective
|
|
48
51
|
# Compute aggregate data
|
49
52
|
@aggregates_data = aggregate(col) if _aggregates.present?
|
50
53
|
|
51
|
-
# Charts too
|
52
|
-
@charts_data = chart(col) if _charts.present?
|
53
|
-
|
54
54
|
# Format all results
|
55
55
|
format(col)
|
56
56
|
|
@@ -161,11 +161,11 @@ module Effective
|
|
161
161
|
end || BLANK
|
162
162
|
end
|
163
163
|
|
164
|
-
def chart(collection)
|
164
|
+
def chart(collection, searched_collection)
|
165
165
|
_charts.inject({}) do |retval, (name, chart)|
|
166
166
|
retval[name] = {
|
167
167
|
as: chart[:as],
|
168
|
-
data: dsl_tool.instance_exec(collection, &chart[:compute]),
|
168
|
+
data: dsl_tool.instance_exec(collection, searched_collection, &chart[:compute]),
|
169
169
|
name: chart[:name],
|
170
170
|
options: chart[:options]
|
171
171
|
}
|
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.20
|
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: 2020-03-
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|