simple_drilldown 0.2.1 → 0.3.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: aec7b1fd59b6e4ebc226c887a44faac2b59bd7feec127d8f1262c52667b2eb44
4
- data.tar.gz: ae14251cd847df59645b1b380a5b658dcec586e7a108ef81206c53f4e9a62de3
3
+ metadata.gz: 26955416527e692a14166b8c0217d9bd693e75d1c457dd248c97dc8303a214ad
4
+ data.tar.gz: 48c8585c11ec20b8b6592d3c275ac3652c331ad5b3d54e940bbd2ffe2161ce5a
5
5
  SHA512:
6
- metadata.gz: 66f65ed0489ad204137194f25f97cf28cdcccb9e02c83bd97b0a3dba7721ed31356feab2d9524c8ac7a4400f65ae2f1190cb504dab732f9ddd6a1059281cd649
7
- data.tar.gz: c84eb9090a79a1e17d5175bf13218f2c3e1aa361667639f0796049bd1020c836eece5fedec457c3fb9a13c2d15d433b99d586aff0e0ea482bf8c4673e8b44d4b
6
+ metadata.gz: ce83b51a48344c0ee5a5394ed8d13033b15a517336e75a4cda02a7778200aa307647ae61179d6f5f89f88c30ef6d6e1183e3d2fce17472886ec2cc5126a220ba
7
+ data.tar.gz: c3c0027fcedaf182a6fc4a74a5591e46630a20039578687ec6cff62dbeaf9327f710c27723aca4c6563d11983dea186467fa8144e12a7d6a0e254a18d4f69d32
@@ -0,0 +1,52 @@
1
+ ruby:
2
+ data =
3
+ case @dimensions.size
4
+ when 0
5
+ { @result[:value] => @result[:count] }
6
+ when 1
7
+ @result[:rows].map { |r| [ @dimensions[0][:label_method] ? @dimensions[0][:label_method].call(r[:value]) : r[:value], r[:count] ] }
8
+ when 2
9
+ @result[:rows].map do |r|
10
+ {
11
+ name: r[:value],
12
+ data: r[:rows].map { |r2| [r2[:value], r2[:count]] }
13
+ }
14
+ end
15
+ when 3
16
+ end
17
+ - case @search.display_type
18
+ - when SimpleDrilldown::Search::DisplayType::PIE
19
+ = pie_chart @chart_data, height: '24rem'
20
+ - when SimpleDrilldown::Search::DisplayType::BAR
21
+ = column_chart data, height: '24rem'
22
+ - when SimpleDrilldown::Search::DisplayType::LINE
23
+ = line_chart data, height: '24rem'
24
+ - else
25
+ #drilldown_area
26
+ h2 = caption
27
+ h3 = subcaption
28
+ br
29
+ #drilldown_search_area style="margin-left: auto; margin-right: auto; text-align: center"
30
+ - (0..2).each do |i|
31
+ - options = [['', '']]
32
+ - options << [@dimensions[i][:pretty_name], @dimensions[i][:url_param_name]] if @dimensions[i]
33
+ - options += @remaining_dimensions.keys.map { |name| [@dimension_defs[name][:pretty_name], name] }
34
+ | #{t(i == 0 ? :group_by : :then_by)}:
35
+ = form.select 'dimensions', options, { :selected => @search.dimensions && @search.dimensions[i] }, \
36
+ { :onChange => 'form.submit()', :name => 'search[dimensions][]', :id => "search_dimensions_#{i}" }
37
+ br
38
+ = t :chart_type
39
+ = form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::BAR, { :onChange => 'form.submit()' }
40
+ = form.label :display_type_bar, t(:bar)
41
+ = form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::PIE, { :disabled => @search.dimensions.size >= 2, :onChange => 'form.submit()' }
42
+ = form.label :display_type_pie, t(:pie)
43
+ = form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::LINE, { :onChange => 'form.submit()' }
44
+ = form.label :display_type_line, t(:line)
45
+ = form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::NONE, { :onChange => 'form.submit()' }
46
+ = form.label :display_type_none, t(:none)
47
+
48
+ = form.check_box :order_by_value, { :onChange => 'form.submit()' }
49
+ = form.label :order_by_value, t(:order_by_value)
50
+
51
+ = form.check_box :list, { :onChange => 'form.submit()' }
52
+ = form.label :list, t(:list)
@@ -1,3 +1,3 @@
1
1
  module SimpleDrilldown
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_drilldown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
@@ -90,7 +90,7 @@ files:
90
90
  - app/jobs/simple_drilldown/application_job.rb
91
91
  - app/mailers/simple_drilldown/application_mailer.rb
92
92
  - app/models/simple_drilldown/application_record.rb
93
- - app/views/drilldown/_chart.html.erb
93
+ - app/views/drilldown/_chart.html.slim
94
94
  - app/views/drilldown/_excel_record_list.builder
95
95
  - app/views/drilldown/_excel_row.builder
96
96
  - app/views/drilldown/_excel_row_header.builder
@@ -1,57 +0,0 @@
1
- <%
2
- # The xml is obtained as a string from builder template.
3
- str_xml = render :file => "drilldown/data_#{@dimensions.size}"
4
- str_xml = str_xml.gsub("\n", "").gsub("\r", "").gsub("&amp;", "&").gsub("'", "").html_safe
5
-
6
- type = nil
7
- case @search.display_type
8
- when SimpleDrilldown::Search::DisplayType::PIE
9
- type = 'Pie3D'
10
- when SimpleDrilldown::Search::DisplayType::BAR
11
- type = (@search.dimensions && @search.dimensions.size >= 2) ? 'MSCombi3D' : 'Column2D'
12
- when SimpleDrilldown::Search::DisplayType::LINE
13
- type = (@search.dimensions && @search.dimensions.size >= 2) ? 'MSLine' : 'Line'
14
- end
15
- if type %>
16
- <div id="chartdiv" align="center">Chart will load here</div>
17
- <script type="text/javascript">
18
- var chart = new FusionCharts("<%= asset_path(type + '.swf') %>", "ChartId_Election", "650", "400", "0", "1");
19
- chart.setXMLData('<%= str_xml %>');
20
- chart.render("chartdiv");
21
- </script>
22
- <% else %>
23
- <div id="drilldown_area">
24
- <h2><%= caption %></h2>
25
- <h3><%= subcaption %></h3>
26
- <br/>
27
- </div>
28
- <% end %>
29
- <div id="drilldown_search_area" style="margin-left: auto; margin-right: auto; text-align: center">
30
- <% (0..2).each do |i| %>
31
- <%
32
- options = [['', '']]
33
- options << [@dimensions[i][:pretty_name], @dimensions[i][:url_param_name]] if @dimensions[i]
34
- options += @remaining_dimensions.keys.map { |name| [@dimension_defs[name][:pretty_name], name] }
35
- %>
36
- <%= t(i == 0 ? :group_by : :then_by) %>:
37
- <%= form.select 'dimensions', options, {:selected => @search.dimensions && @search.dimensions[i]},
38
- {:onChange => 'form.submit()', :name => 'search[dimensions][]', :id => "search_dimensions_#{i}"}
39
- %>
40
- <% end %>
41
- <br/>
42
- <%= t :chart_type %>:
43
- <%= form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::BAR, {:onChange => 'form.submit()'} %>
44
- <%= form.label :display_type_bar, t(:bar) %>
45
- <%= form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::PIE, {:disabled => @search.dimensions.size >= 2, :onChange => 'form.submit()'} %>
46
- <%= form.label :display_type_pie, t(:pie) %>
47
- <%= form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::LINE, {:onChange => 'form.submit()'} %>
48
- <%= form.label :display_type_line, t(:line) %>
49
- <%= form.radio_button 'display_type', SimpleDrilldown::Search::DisplayType::NONE, {:onChange => 'form.submit()'} %>
50
- <%= form.label :display_type_none, t(:none) %>
51
-
52
- <%= form.check_box :order_by_value, {:onChange => 'form.submit()'} %>
53
- <%= form.label :order_by_value, t(:order_by_value) %>
54
-
55
- <%= form.check_box :list, {:onChange => 'form.submit()'} %>
56
- <%= form.label :list, t(:list) %>
57
- </div>