simple_drilldown 0.6.8 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42c85e43c9d07d94ed0d7c502afa8b4ee638f86ca41bf6b742f7f34cfd47a355
4
- data.tar.gz: 506ac06824fd78a878302544967b7f997bfae64c6e4e26da9b5955603595ffc2
3
+ metadata.gz: 8b9e45eda9e3936d570de7055da2f5ec4eea29f3bfc6a8acc7a7134d364e2343
4
+ data.tar.gz: e4738f7b4a2bb699724c34b3fcf764de181c56bdfb015f9274a048e8b630a363
5
5
  SHA512:
6
- metadata.gz: 4dbf710685173878b38ce96238eb9c1e558bd4b9472d0f928146920f21b2de3a4eb3c64195ad87da9940383f7190c6d89404419390bce6f4fcceb134a959f634
7
- data.tar.gz: aa1f9ba981439836636dcab9a0adcd61b834f7c5e2667b86dd43980d7b3a3072f2df2b4ab6e7d6f7161fa7ed449c9473fd1a796692680dbffeb6a25e9977f0ee
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: '/layouts/excel_styles')
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 (l :short_date).to_s, 'ss:Type' => 'String'
32
+ xml.Data (t :short_date).to_s, 'ss:Type' => 'String'
33
33
  end
34
34
  xml.Cell do
35
- xml.Data (l :time).to_s, 'ss:Type' => 'String'
35
+ xml.Data (t :time).to_s, 'ss:Type' => 'String'
36
36
  end
37
37
  else
38
38
  xml.Cell do
39
- xml.Data (l field).to_s, 'ss:Type' => 'String'
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
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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
- <%= render 'layouts/headers' %>
6
- <%= stylesheet_link_tag 'drilldown' %>
5
+ <%= stylesheet_link_tag 'application' %>
7
6
  <body>
8
7
  <style type="text/css">
9
- @media print {#print_link {display: none}}
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}_drilldown"
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: "COALESCE(#{queries.map { |q| q[:select] }.join(',')})",
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
- render template: '/drilldown/excel_export', layout: false
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
- index(false)
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 = path)
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
@@ -1,3 +1,3 @@
1
1
  module SimpleDrilldown
2
- VERSION = '0.6.8'
2
+ VERSION = '0.7.0'
3
3
  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.6.8
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-09-25 00:00:00.000000000 Z
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/excel_export_transactions.builder
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