simple_drilldown 0.15.0 → 0.15.2
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/README.md +1 -5
- data/app/views/simple_drilldown/_chart.html.erb +3 -2
- data/app/views/simple_drilldown/_excel_record_list_xlsx.xlsx.axlsx +2 -2
- data/app/views/simple_drilldown/data_0.builder +1 -1
- data/app/views/simple_drilldown/data_1.builder +1 -1
- data/app/views/simple_drilldown/data_2.builder +1 -1
- data/app/views/simple_drilldown/data_3.builder +1 -1
- data/app/views/simple_drilldown/excel_export_xlsx.xlsx.axlsx +4 -4
- data/lib/simple_drilldown/controller.rb +8 -8
- data/lib/simple_drilldown/engine.rb +1 -1
- data/lib/simple_drilldown/helper.rb +8 -8
- data/lib/simple_drilldown/routing.rb +2 -2
- data/lib/simple_drilldown/search.rb +5 -5
- data/lib/simple_drilldown/version.rb +1 -1
- data/lib/tasks/simple_drilldown_tasks.rake +1 -0
- 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: 50ce0bfb3d2e5b06d86f9536597fcc7066cc35fab2d852d5f284ebc91a412412
|
4
|
+
data.tar.gz: 38da1d31d519c9f2940603493e46c903ab920481cac58fbdc3ca0d1f62a2fae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2737e665d28ec3bc21147da196032d9fab30b11591d3c1a34f92877ede0cb6d6efc653b19e4a1f8e406fbe582d7795bb55afaa9b42977e90a8550d6f293992
|
7
|
+
data.tar.gz: 6f34bb184098eb49d941628ed705625d35eb704c339b18886ff824a1cda1787979486d4094e42b67f4faf40ce81b585d64f9dfc75d0587aa3b6f2989c1ceceaf
|
data/README.md
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
# SimpleDrilldown
|
2
|
-
|
3
|
-
<a href="https://travis-ci.org/DatekWireless/simple_drilldown">
|
4
|
-
<img align="right" src="https://travis-ci.org/DatekWireless/simple_drilldown.svg?branch=master" alt="Build Status">
|
5
|
-
</a>
|
1
|
+
# SimpleDrilldown [](https://github.com/DatekWireless/simple_drilldown/actions/workflows/test.yml)
|
6
2
|
|
7
3
|
`simple_drilldown` offers a simple way to define axis to filter and group records
|
8
4
|
for analysis. The result is a record count for the selected filter and
|
@@ -87,7 +87,8 @@
|
|
87
87
|
firstPoint = chart.getElementsAtEventForMode(e, 'nearest', { intersect: true }, false)[0]
|
88
88
|
if (firstPoint) {
|
89
89
|
label = chart.data.labels[firstPoint.index];
|
90
|
-
|
90
|
+
const values = <%== @result[:rows].map { |r| r[:value] }.to_json %>;
|
91
|
+
value = values[firstPoint.index];
|
91
92
|
new_location = new URL(window.location.toString());
|
92
93
|
new_location.hash = '';
|
93
94
|
params = new_location.searchParams;
|
@@ -101,7 +102,7 @@
|
|
101
102
|
}
|
102
103
|
}
|
103
104
|
params.delete('search[filter][<%= @dimensions[0][:url_param_name] %>][]');
|
104
|
-
params.set('search[filter][<%= @dimensions[0][:url_param_name] %>][]',
|
105
|
+
params.set('search[filter][<%= @dimensions[0][:url_param_name] %>][]', value);
|
105
106
|
new_location.searchParams = params;
|
106
107
|
window.location = new_location.href;
|
107
108
|
}
|
@@ -9,7 +9,7 @@ def excel_header_row(sheet)
|
|
9
9
|
sheet.add_row row
|
10
10
|
end
|
11
11
|
|
12
|
-
def excel_row(sheet,
|
12
|
+
def excel_row(sheet, _wrap, transaction:)
|
13
13
|
padding_cells = @dimensions.empty? ? 1 : @dimensions.size
|
14
14
|
row = (1..(padding_cells - 1)).map { |_n| nil }
|
15
15
|
|
@@ -37,7 +37,7 @@ def excel_row(sheet, wrap, transaction:)
|
|
37
37
|
|
38
38
|
row << value
|
39
39
|
end
|
40
|
-
sheet.add_row row, style: wrap
|
40
|
+
sheet.add_row row # , style: wrap
|
41
41
|
end
|
42
42
|
|
43
43
|
sheet.add_row []
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
xml.chart(xAxisName: 'Elections',
|
4
|
-
showValues: '1', caption
|
4
|
+
showValues: '1', caption:, subcaption:,
|
5
5
|
yAxisName: "Election #{t(@search.select_value.downcase)}", numberSuffix: '') do
|
6
6
|
xml.set(
|
7
7
|
name: @result[:value0],
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
xml.chart(xAxisName: (@dimensions[0][:pretty_name] || 'Elections').gsub("'", ''),
|
4
|
-
showValues: '1', caption
|
4
|
+
showValues: '1', caption:, subcaption:,
|
5
5
|
yAxisName: "Election #{t(@search.select_value.downcase)}", numberSuffix: '') do
|
6
6
|
@result[:rows].each do |res|
|
7
7
|
xml.set name: @dimensions[0][:label_method] ? @dimensions[0][:label_method].call(res[:value]) : res[:value],
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
xml.chart(
|
4
4
|
xAxisName: (@dimensions[0][:pretty_name] || 'Elections').gsub("'", ''), palette: '2',
|
5
|
-
caption
|
5
|
+
caption:, subcaption:,
|
6
6
|
showNames: '1',
|
7
7
|
showValues: @result[:rows].size > 15 || (@result[:rows][0] && @result[:rows][0][:rows].size > 4) ? 0 : 1,
|
8
8
|
decimals: '0',
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
xml.chart(
|
4
4
|
xAxisName: (@dimensions[0][:pretty_name] || 'Elections').gsub("'", ''), palette: '2',
|
5
|
-
caption
|
5
|
+
caption:, subcaption:,
|
6
6
|
showNames: '1',
|
7
7
|
showValues:
|
8
8
|
@result[:rows].size > 15 || (@result[:rows][0] && @result[:rows][0][:rows].size > 4) ? 0 : 1,
|
@@ -21,19 +21,19 @@ def excel_summary_row_xlsx(sheet, result, parent_result = nil, dimension = 0, he
|
|
21
21
|
end
|
22
22
|
else
|
23
23
|
render(partial: '/simple_drilldown/excel_summary_row_xlsx',
|
24
|
-
locals: { sheet
|
25
|
-
dimension:
|
24
|
+
locals: { sheet:, result:, parent_result:, headers: headers.dup,
|
25
|
+
dimension: })
|
26
26
|
|
27
27
|
if @search.list
|
28
28
|
render(partial: '/simple_drilldown/excel_record_list_xlsx',
|
29
|
-
locals: { sheet
|
29
|
+
locals: { sheet:, result: })
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
return if dimension >= @dimensions.size
|
34
34
|
|
35
35
|
render(partial: '/simple_drilldown/excel_summary_total_row_xlsx', locals: {
|
36
|
-
sheet
|
36
|
+
sheet:, result:, headers: headers.dup, dimension:
|
37
37
|
})
|
38
38
|
end
|
39
39
|
|
@@ -105,7 +105,7 @@ module SimpleDrilldown
|
|
105
105
|
conditions = options.delete(:where)
|
106
106
|
queries = [{
|
107
107
|
select: select_expression,
|
108
|
-
includes
|
108
|
+
includes:,
|
109
109
|
where: conditions
|
110
110
|
}]
|
111
111
|
end
|
@@ -135,15 +135,15 @@ module SimpleDrilldown
|
|
135
135
|
a.concat(*i)
|
136
136
|
end
|
137
137
|
end,
|
138
|
-
interval
|
139
|
-
label_method
|
140
|
-
legal_values
|
141
|
-
pretty_name
|
142
|
-
queries
|
143
|
-
reverse
|
138
|
+
interval:,
|
139
|
+
label_method:,
|
140
|
+
legal_values:,
|
141
|
+
pretty_name:,
|
142
|
+
queries:,
|
143
|
+
reverse:,
|
144
144
|
select_expression:
|
145
145
|
queries.size == 1 ? queries[0][:select] : "COALESCE(#{queries.map { |q| q[:select] }.join(',')})",
|
146
|
-
row_class
|
146
|
+
row_class:,
|
147
147
|
url_param_name: name.to_s
|
148
148
|
}
|
149
149
|
end
|
@@ -9,7 +9,7 @@ module SimpleDrilldown
|
|
9
9
|
config.autoload_paths << File.dirname(__dir__)
|
10
10
|
|
11
11
|
initializer 'simple_drilldown.assets.precompile' do |app|
|
12
|
-
app.config.try(:assets)&.precompile&.
|
12
|
+
app.config.try(:assets)&.precompile&.push('simple_drilldown/application.css', 'chartkick.js')
|
13
13
|
end
|
14
14
|
|
15
15
|
ActionDispatch::Routing::Mapper.include SimpleDrilldown::Routing
|
@@ -25,8 +25,8 @@ module SimpleDrilldown
|
|
25
25
|
|
26
26
|
def summary_row(result, parent_result = nil, dimension = 0, headers = [], new_row: true)
|
27
27
|
html = render(partial: '/simple_drilldown/summary_row', locals: {
|
28
|
-
result
|
29
|
-
headers
|
28
|
+
result:, parent_result:, new_row:, dimension:,
|
29
|
+
headers:, with_results: !result[:rows]
|
30
30
|
})
|
31
31
|
if result[:rows]
|
32
32
|
sub_headers = headers + [{
|
@@ -38,12 +38,12 @@ module SimpleDrilldown
|
|
38
38
|
html << summary_row(r, result, dimension + 1, sub_headers, new_row: i.positive?)
|
39
39
|
end
|
40
40
|
elsif @search.list
|
41
|
-
html << render(partial: '/simple_drilldown/record_list', locals: { result
|
41
|
+
html << render(partial: '/simple_drilldown/record_list', locals: { result:, dimension: })
|
42
42
|
end
|
43
43
|
if dimension < @dimensions.size
|
44
44
|
html << render(partial: '/simple_drilldown/summary_total_row',
|
45
45
|
locals: {
|
46
|
-
result
|
46
|
+
result:, parent_result:, headers: headers.dup, dimension:
|
47
47
|
})
|
48
48
|
end
|
49
49
|
|
@@ -72,15 +72,15 @@ module SimpleDrilldown
|
|
72
72
|
end
|
73
73
|
else
|
74
74
|
xml << render(partial: '/simple_drilldown/excel_summary_row',
|
75
|
-
locals: { result
|
76
|
-
dimension:
|
75
|
+
locals: { result:, parent_result:, headers: headers.dup,
|
76
|
+
dimension: })
|
77
77
|
|
78
|
-
xml << render(partial: '/simple_drilldown/excel_record_list', locals: { result:
|
78
|
+
xml << render(partial: '/simple_drilldown/excel_record_list', locals: { result: }) if @search.list
|
79
79
|
end
|
80
80
|
|
81
81
|
if dimension < @dimensions.size
|
82
82
|
xml << render(partial: '/simple_drilldown/excel_summary_total_row', locals: {
|
83
|
-
result
|
83
|
+
result:, headers: headers.dup, dimension:
|
84
84
|
})
|
85
85
|
end
|
86
86
|
xml
|
@@ -7,9 +7,9 @@ module SimpleDrilldown
|
|
7
7
|
path = "#{path}_drilldown" unless /_drilldown$/.match?(path)
|
8
8
|
controller ||= path
|
9
9
|
get "#{path}(.:format)" => "#{controller}#index", as: path
|
10
|
-
scope path, controller
|
10
|
+
scope path, controller:, as: path do
|
11
11
|
{ excel_export: :xlsx, excel_export_records: :xlsx, html_export: :html }.each do |action, format|
|
12
|
-
get action, defaults: { format:
|
12
|
+
get action, defaults: { format: }
|
13
13
|
end
|
14
14
|
get 'choices/:dimension_name', action: :choices, as: :choices
|
15
15
|
yield if block_given?
|
@@ -51,7 +51,7 @@ module SimpleDrilldown
|
|
51
51
|
@dimensions.delete_if(&:empty?)
|
52
52
|
@filter = attributes && attributes[:filter] ? attributes[:filter] : {}
|
53
53
|
@filter.keys.dup.each { |k| @filter[k] = Array(@filter[k]) }
|
54
|
-
@filter.
|
54
|
+
@filter.each_value do |v|
|
55
55
|
v.delete('')
|
56
56
|
v.delete('Select Some Options')
|
57
57
|
end
|
@@ -80,13 +80,13 @@ module SimpleDrilldown
|
|
80
80
|
def url_options
|
81
81
|
o = {
|
82
82
|
search: {
|
83
|
-
title
|
83
|
+
title:,
|
84
84
|
list: list ? '1' : '0',
|
85
85
|
percent: percent ? '1' : '0',
|
86
86
|
list_change_times: list_change_times ? '1' : '0',
|
87
|
-
filter
|
88
|
-
dimensions
|
89
|
-
display_type:
|
87
|
+
filter:,
|
88
|
+
dimensions:,
|
89
|
+
display_type:
|
90
90
|
}
|
91
91
|
}
|
92
92
|
o[:search][:fields] = fields unless fields == @default_fields
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_drilldown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caxlsx_rails
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '7.0'
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '8'
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
57
|
+
version: '7.0'
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '8'
|
@@ -138,14 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements:
|
139
139
|
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
141
|
+
version: '3.1'
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
rubygems_version: 3.4.
|
148
|
+
rubygems_version: 3.4.19
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Simple data warehouse and drilldown.
|