simple_drilldown 0.6.8 → 0.7.0
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_export_transactions.builder → excel_export_records.builder} +4 -4
- data/app/views/drilldown/print.html.erb +7 -4
- data/lib/generators/drilldown_controller/drilldown_controller_generator.rb +1 -1
- data/lib/simple_drilldown/controller.rb +11 -7
- data/lib/simple_drilldown/routing.rb +6 -4
- data/lib/simple_drilldown/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b9e45eda9e3936d570de7055da2f5ec4eea29f3bfc6a8acc7a7134d364e2343
|
4
|
+
data.tar.gz: e4738f7b4a2bb699724c34b3fcf764de181c56bdfb015f9274a048e8b630a363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3eb61535dcd5068e5353f5076c29fb1632aaa252f4bbb61d1644295c423db4f063f12a0417f3495f3b6dde3c01501351b1052af3dca04b1d43b59320e74e33c
|
7
|
+
data.tar.gz: 9f424d5a153153886d7f2732d1dbeeb7f141095f9fc991e4b32f1a09b4e4dee32de54564b67101f74a9d31127627e37a80ebd514e24a5b0e2f60a22c236cb6d1
|
@@ -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
|
@@ -29,14 +29,14 @@ xml.Workbook(
|
|
29
29
|
@transaction_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
|
@@ -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">
|
@@ -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
|
@@ -128,7 +128,8 @@ module SimpleDrilldown
|
|
128
128
|
pretty_name: I18n.t(name, default: :"activerecord.models.#{name}"),
|
129
129
|
queries: queries,
|
130
130
|
reverse: reverse,
|
131
|
-
select_expression:
|
131
|
+
select_expression:
|
132
|
+
queries.size == 1 ? queries[0][:select] : "COALESCE(#{queries.map { |q| q[:select] }.join(',')})",
|
132
133
|
row_class: row_class,
|
133
134
|
url_param_name: name.to_s
|
134
135
|
}
|
@@ -385,21 +386,24 @@ module SimpleDrilldown
|
|
385
386
|
|
386
387
|
def html_export
|
387
388
|
index(false)
|
388
|
-
render template: '/drilldown/html_export', layout: 'print'
|
389
|
+
render template: '/drilldown/html_export', layout: '../drilldown/print'
|
389
390
|
end
|
390
391
|
|
391
392
|
def excel_export
|
392
393
|
index(false)
|
393
394
|
set_excel_headers
|
394
|
-
|
395
|
+
if params.dig(:search, :list) == '1'
|
396
|
+
@records = get_records(@result)
|
397
|
+
render template: '/drilldown/excel_export_records', layout: false
|
398
|
+
else
|
399
|
+
render template: '/drilldown/excel_export', layout: false
|
400
|
+
end
|
395
401
|
end
|
396
402
|
|
397
403
|
def excel_export_records
|
404
|
+
params[:search] ||= {}
|
398
405
|
params[:search][:list] = '1'
|
399
|
-
|
400
|
-
@records = get_records(@result)
|
401
|
-
set_excel_headers
|
402
|
-
render template: '/drilldown/excel_export_records', layout: false
|
406
|
+
excel_export
|
403
407
|
end
|
404
408
|
|
405
409
|
private
|
@@ -3,11 +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[choices excel_export html_export index].each do |action|
|
10
|
-
get "#{action}(/:id)(.:format)", controller: controller, action: action
|
10
|
+
scope path, as: path do
|
11
|
+
%i[choices excel_export excel_export_records html_export index].each do |action|
|
12
|
+
get "#{action}(/:id)(.:format)", controller: controller, action: action, as: action
|
11
13
|
end
|
12
14
|
end
|
13
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -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
|