simple_drilldown 0.6.8 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/drilldown/_excel_styles.builder +1 -2
- data/app/views/drilldown/{excel_export_transactions.builder → excel_export_records.builder} +8 -7
- data/app/views/drilldown/html_export.html.erb +3 -3
- data/app/views/drilldown/print.html.erb +7 -4
- data/config/routes.rb +1 -0
- data/lib/generators/drilldown_controller/drilldown_controller_generator.rb +1 -1
- data/lib/simple_drilldown/controller.rb +15 -7
- data/lib/simple_drilldown/helper.rb +4 -0
- data/lib/simple_drilldown/routing.rb +6 -5
- data/lib/simple_drilldown/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: 1a36aab8c580f75685e00d36a6aea2bbb1b58b43c153db650ec9298cf0b5fff6
|
4
|
+
data.tar.gz: 6c1a7cda78d09fdff2519c1db52dd4c5aa7f2c7c273bc7b9f6bc730cf02b6d80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587b979884e3cdb8a85fee6438358bf5ba3878ff55b1355b52e987b1b896d686558fbcde181d9c1bc1a62b0ec7a6fbe591fb36c621d59d5688e0655c31170dff
|
7
|
+
data.tar.gz: a4e90f4858363cea570a5544efb0ed45bb4ae541a4a2238511bf726755f6ced093e5f9dde0574f21f6e1b7621b9564788c9795f2ebd1e8c721014472b2f50d44
|
@@ -46,8 +46,7 @@ xml.Styles do
|
|
46
46
|
xml.Interior 'ss:Color' => '#dedede', 'ss:Pattern' => 'Solid'
|
47
47
|
xml.NumberFormat 'ss:Format' => "\#,\#\#0"
|
48
48
|
end
|
49
|
-
xml.Style 'ss:ID' => 'Outer'
|
50
|
-
end
|
49
|
+
xml.Style 'ss:ID' => 'Outer'
|
51
50
|
xml.Style 'ss:ID' => 'ShortDate' do
|
52
51
|
xml.NumberFormat 'ss:Format' => 'Short Date'
|
53
52
|
end
|
@@ -10,7 +10,7 @@ xml.Workbook(
|
|
10
10
|
'xmlns:ss' => 'urn:schemas-microsoft-com:office:spreadsheet',
|
11
11
|
'xmlns:html' => 'http://www.w3.org/TR/REC-html40'
|
12
12
|
) do
|
13
|
-
xml << render(partial: '/
|
13
|
+
xml << render(partial: '/drilldown/excel_styles')
|
14
14
|
|
15
15
|
xml.Worksheet 'ss:Name' => 'Drilldown' do
|
16
16
|
xml.Table do
|
@@ -26,17 +26,17 @@ xml.Workbook(
|
|
26
26
|
end
|
27
27
|
|
28
28
|
xml.Row 'ss:StyleID' => 'Heading' do
|
29
|
-
@
|
29
|
+
@search.fields.each do |field|
|
30
30
|
if field == 'time'
|
31
31
|
xml.Cell do
|
32
|
-
xml.Data (
|
32
|
+
xml.Data (t :short_date).to_s, 'ss:Type' => 'String'
|
33
33
|
end
|
34
34
|
xml.Cell do
|
35
|
-
xml.Data (
|
35
|
+
xml.Data (t :time).to_s, 'ss:Type' => 'String'
|
36
36
|
end
|
37
37
|
else
|
38
38
|
xml.Cell do
|
39
|
-
xml.Data (
|
39
|
+
xml.Data (t field).to_s, 'ss:Type' => 'String'
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -44,7 +44,7 @@ xml.Workbook(
|
|
44
44
|
|
45
45
|
@records.each do |transaction|
|
46
46
|
xml.Row do
|
47
|
-
@
|
47
|
+
@search.fields.each do |field|
|
48
48
|
field_map = controller.c_fields[field.to_sym]
|
49
49
|
if field == 'time'
|
50
50
|
xml.Cell 'ss:StyleID' => 'DateOnlyFormat' do
|
@@ -54,7 +54,8 @@ xml.Workbook(
|
|
54
54
|
xml.Data transaction.completed_at.gmtime.xmlschema, 'ss:Type' => 'DateTime'
|
55
55
|
end
|
56
56
|
else
|
57
|
-
|
57
|
+
attr_method = field_map[:attr_method]
|
58
|
+
value = attr_method ? attr_method.call(transaction) : transaction.send(field)
|
58
59
|
xml.Cell field_map[:excel_style] ? { 'ss:StyleID' => field_map[:excel_style] } : {} do
|
59
60
|
xml.Data value, 'ss:Type' => field_map[:excel_type] || 'String'
|
60
61
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<%=
|
6
|
-
<%= stylesheet_link_tag 'drilldown' %>
|
5
|
+
<%= stylesheet_link_tag 'application' %>
|
7
6
|
<body>
|
8
7
|
<style type="text/css">
|
9
|
-
|
8
|
+
@media print {
|
9
|
+
#print_link {
|
10
|
+
display: none
|
11
|
+
}
|
12
|
+
}
|
10
13
|
</style>
|
11
14
|
<div class="container">
|
12
15
|
<div id="print_link" class="pull-right">
|
data/config/routes.rb
CHANGED
@@ -6,6 +6,6 @@ class DrilldownControllerGenerator < Rails::Generators::NamedBase
|
|
6
6
|
def copy_drilldown_controller_file
|
7
7
|
template 'drilldown_controller.rb.erb', "app/controllers/#{file_name}_drilldown_controller.rb"
|
8
8
|
template 'drilldown_controller_test.rb.erb', "test/controllers/#{file_name}_drilldown_controller_test.rb"
|
9
|
-
route "draw_drilldown :#{singular_name}
|
9
|
+
route "draw_drilldown :#{singular_name}"
|
10
10
|
end
|
11
11
|
end
|
@@ -36,6 +36,9 @@ module SimpleDrilldown
|
|
36
36
|
# No default target class found
|
37
37
|
end
|
38
38
|
end
|
39
|
+
return unless base.c_target_class.try :paranoid?
|
40
|
+
|
41
|
+
base.c_base_condition = "#{base.c_target_class.table_name}.deleted_at IS NULL"
|
39
42
|
end
|
40
43
|
|
41
44
|
def base_condition(base_condition)
|
@@ -128,7 +131,8 @@ module SimpleDrilldown
|
|
128
131
|
pretty_name: I18n.t(name, default: :"activerecord.models.#{name}"),
|
129
132
|
queries: queries,
|
130
133
|
reverse: reverse,
|
131
|
-
select_expression:
|
134
|
+
select_expression:
|
135
|
+
queries.size == 1 ? queries[0][:select] : "COALESCE(#{queries.map { |q| q[:select] }.join(',')})",
|
132
136
|
row_class: row_class,
|
133
137
|
url_param_name: name.to_s
|
134
138
|
}
|
@@ -319,6 +323,7 @@ module SimpleDrilldown
|
|
319
323
|
|
320
324
|
conditions, @filter_text, filter_includes = self.class.make_conditions(@search.filter)
|
321
325
|
includes += filter_includes
|
326
|
+
includes.flatten!
|
322
327
|
includes.keep_if(&:present?).uniq!
|
323
328
|
if @search.order_by_value && @dimensions.size <= 1
|
324
329
|
order = case @search.select_value
|
@@ -385,21 +390,24 @@ module SimpleDrilldown
|
|
385
390
|
|
386
391
|
def html_export
|
387
392
|
index(false)
|
388
|
-
render template: '/drilldown/html_export', layout: 'print'
|
393
|
+
render template: '/drilldown/html_export', layout: '../drilldown/print'
|
389
394
|
end
|
390
395
|
|
391
396
|
def excel_export
|
392
397
|
index(false)
|
393
398
|
set_excel_headers
|
394
|
-
|
399
|
+
if params.dig(:search, :list) == '1'
|
400
|
+
@records = get_records(@result)
|
401
|
+
render template: '/drilldown/excel_export_records', layout: false
|
402
|
+
else
|
403
|
+
render template: '/drilldown/excel_export', layout: false
|
404
|
+
end
|
395
405
|
end
|
396
406
|
|
397
407
|
def excel_export_records
|
408
|
+
params[:search] ||= {}
|
398
409
|
params[:search][:list] = '1'
|
399
|
-
|
400
|
-
@records = get_records(@result)
|
401
|
-
set_excel_headers
|
402
|
-
render template: '/drilldown/excel_export_records', layout: false
|
410
|
+
excel_export
|
403
411
|
end
|
404
412
|
|
405
413
|
private
|
@@ -3,6 +3,10 @@
|
|
3
3
|
module SimpleDrilldown
|
4
4
|
# View helper for SimpleDrilldown
|
5
5
|
module Helper
|
6
|
+
# FIXME(uwe): Should not be necessary: https://github.com/rails/rails/issues/41038
|
7
|
+
include Rails.application.routes.url_helpers
|
8
|
+
# EMXIF
|
9
|
+
|
6
10
|
def value_label(dimension_index, value)
|
7
11
|
dimension = @dimensions[dimension_index]
|
8
12
|
return nil if dimension.nil?
|
@@ -3,12 +3,13 @@
|
|
3
3
|
module SimpleDrilldown
|
4
4
|
# Routing helper methods
|
5
5
|
module Routing
|
6
|
-
def draw_drilldown(path, controller =
|
6
|
+
def draw_drilldown(path, controller = nil)
|
7
|
+
path = "#{path}_drilldown" unless /_drilldown$/.match?(path)
|
8
|
+
controller ||= path
|
7
9
|
get "#{path}(.:format)" => "#{controller}#index", as: path
|
8
|
-
scope path do
|
9
|
-
%i[
|
10
|
-
|
11
|
-
end
|
10
|
+
scope path, controller: controller, as: path do
|
11
|
+
%i[excel_export excel_export_records html_export].each { |action| get action }
|
12
|
+
get 'choices/:dimension_name', action: :choices, as: :choices
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
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.
|
4
|
+
version: 0.7.4
|
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: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '1.1'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '1.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: sqlite3
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,7 @@ files:
|
|
113
113
|
- app/views/drilldown/data_2.builder
|
114
114
|
- app/views/drilldown/data_3.builder
|
115
115
|
- app/views/drilldown/excel_export.builder
|
116
|
-
- app/views/drilldown/
|
116
|
+
- app/views/drilldown/excel_export_records.builder
|
117
117
|
- app/views/drilldown/html_export.html.erb
|
118
118
|
- app/views/drilldown/index.html.erb
|
119
119
|
- app/views/drilldown/print.html.erb
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.2.3
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Simple data warehouse and drilldown.
|