simple_drilldown 0.9.5 → 0.9.10

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: 48e5faf8ea7325353ae1283ed36863a2721ba4110c883be528314b7c868af356
4
- data.tar.gz: aaa55b27d81bef734bb52c897eff6c437c05832400fbc29bbed219ccf02e0ea3
3
+ metadata.gz: 20b3fbd48f5942a10b5ffa459c1c9c900f8275d800eb52819945a7aacda37440
4
+ data.tar.gz: cf384149ace94850f19310210d4cc0a278b7dde606753afbe5e43dfd5600e88d
5
5
  SHA512:
6
- metadata.gz: a711048cd982171d465dfffc99e6155f3d22d0ca2d2c6cdb55f2be590aa76994036135e186bd7b1a5f594f9986799618208d42bd25b6e2f71452878f117e2a46
7
- data.tar.gz: dbb15e5f741988a2b09f1cb27005d0bece4930572e24e96773752f6648608e5e88a648e0572fb3370713f5756789b543a4962f1b9320646e713cc11a9f66c71d
6
+ metadata.gz: c9e55d9444a72c13d3fde5ac7b58f60941299ae15d45fdcfda1dd0b4db385df99b5fbdf36570131328f007da3896a33d0caa26c411c0295cf499279bda5a3e22
7
+ data.tar.gz: f0f6794cd72544eca752af71dcaae8f153de7674424e0eebe7f99f34f453edf1f32caf1fa6b198f41d9b49948d0a7513b5940a9c9177014e77d08ea08d84a6bb
@@ -1,14 +1,16 @@
1
- <table id="drilldown-summary-table" class="table table-sm table-bordered">
2
- <thead>
3
- <tr>
4
- <% @dimensions.each do |d| %>
5
- <th><%= h d[:pretty_name] %></th>
6
- <% end %>
7
- <th><%= t controller.c_target_class.table_name.capitalize %></th>
8
- <%= controller.c_summary_fields.map { |l| "<th>#{t(l)}</th>" }.join("\n").html_safe %>
9
- </tr>
10
- </thead>
11
- <tbody>
12
- <%= summary_row(@result) %>
13
- </tbody>
14
- </table>
1
+ <div class="table-responsive">
2
+ <table id="drilldown-summary-table" class="table table-sm table-bordered">
3
+ <thead>
4
+ <tr>
5
+ <% @dimensions.each do |d| %>
6
+ <th><%= d[:pretty_name] %></th>
7
+ <% end %>
8
+ <th><%= t controller.c_target_class.table_name, default: controller.c_target_class.table_name.capitalize %></th>
9
+ <%= controller.c_summary_fields.map { |l| "<th>#{t(l)}</th>" }.join("\n").html_safe %>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <%= summary_row(@result) %>
14
+ </tbody>
15
+ </table>
16
+ </div>
@@ -1,4 +1,12 @@
1
1
  <tr class="summary">
2
2
  <td colspan="<%= @dimensions.size - dimension %>"></td>
3
3
  <td align="right"><%= result[:count] %></td>
4
+ <% controller.c_summary_fields.each do |summary_field| %>
5
+ <td align="right">
6
+ <%= result[summary_field] %>
7
+ <% if @search.percent && parent_result && parent_result[summary_field] > 0 %>
8
+ (<%= 100 * result[summary_field] / parent_result[summary_field] %>%)
9
+ <% end %>
10
+ </td>
11
+ <% end %>
4
12
  </tr>
@@ -85,7 +85,15 @@ module SimpleDrilldown
85
85
  self.c_summary_fields = summary_fields.flatten
86
86
  end
87
87
 
88
- def dimension(name, select_expression = name, options = {})
88
+ def dimension(name, select_expression = name.to_s, options = {})
89
+ if select_expression.is_a?(Hash)
90
+ unless options.blank?
91
+ raise "select_expression should be a string: #{select_expression.class}, options: #{options.inspect}"
92
+ end
93
+
94
+ options = select_expression
95
+ select_expression = name.to_s
96
+ end
89
97
  interval = options.delete(:interval)
90
98
  label_method = options.delete(:label_method)
91
99
  legal_values = options.delete(:legal_values) || legal_values_for(name)
@@ -89,7 +89,8 @@ module SimpleDrilldown
89
89
  private
90
90
 
91
91
  def caption_txt
92
- "#{controller.c_target_class} #{I18n.t(@search.select_value.downcase)}" +
92
+ "#{controller.c_target_class} #{I18n.t(@search.select_value.downcase,
93
+ default: @search.select_value.to_s.titleize)}" +
93
94
  (@dimensions && @dimensions.any? ? " by #{@dimensions.map { |d| d[:pretty_name] }.join(' and ')}" : '')
94
95
  end
95
96
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleDrilldown
2
- VERSION = '0.9.5'
2
+ VERSION = '0.9.10'
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.9.5
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caxlsx_rails