simple_drilldown 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32063b0fd8dec6ee846e38eb37753d795acb2c6f3cca5d98a45d6c6a9c9bd868
4
- data.tar.gz: 4c95e97c4780f82a6227a0f5e2048c7501d29e5534e7c74953746be915f42b1d
3
+ metadata.gz: c25058c9633cfe67926c2cbf3dca1105481fde8297077ba68414063ab239e05e
4
+ data.tar.gz: 5ff52f26970deef096886d62451ca80f545d3fbf88601ed20cc2ed3334c01397
5
5
  SHA512:
6
- metadata.gz: b78736b952b5c7727ea627d83a4c47a72cf0665fded104fd6f65bb0f0adfc8b09a6899c4b832ce3a05991e05be2be8496ba6935ac24bc618af4492f7b997833b
7
- data.tar.gz: e4f976920fcd12bd3820c390b22dd0d36af9a13f6d3f01517acb82574879d0196f4fc6fe7417a91a5a916a064d3187bc115119bfa1f16ea8954d53e9ee61b159
6
+ metadata.gz: 478e1fa749626a6599055b82022553c5778f8ef4085fa513f28261c9340cb3a112235ff6968115f95de00d4c4af4ec6d9e9b721596edd03693249c5e299e0938
7
+ data.tar.gz: 2c4b94ae99c33ced23f149fbb0d0f5356867773a13e979619fe0c030ae83fbfac18444579b2b6b78427c48bca1e66a650455640a9d1fe9d95eb2c9629116a2ad
@@ -20,7 +20,7 @@
20
20
  case @search.display_type
21
21
  when SimpleDrilldown::Search::DisplayType::PIE
22
22
  %>
23
- <%= pie_chart data, height: '24rem' %>
23
+ <%= pie_chart data, height: '24rem', events: ['click'] %>
24
24
  <% when SimpleDrilldown::Search::DisplayType::BAR %>
25
25
  <%= column_chart data, height: '24rem' %>
26
26
  <% when SimpleDrilldown::Search::DisplayType::LINE %>
@@ -40,7 +40,7 @@
40
40
  options += @remaining_dimensions.keys.map { |name| [controller.c_dimension_defs[name][:pretty_name], name] } %>
41
41
  <%= t(i == 0 ? :group_by : :then_by) %>:
42
42
  <%= form.select 'dimensions', options, { :selected => @search.dimensions && @search.dimensions[i] },
43
- { :onChange => 'form.submit()', :name => 'search[dimensions][]', :id => "search_dimensions_#{i}" } %>
43
+ { onChange: 'form.submit()', name: 'search[dimensions][]', id: "search_dimensions_#{i}" } %>
44
44
  <% end %>
45
45
 
46
46
  <br/>
@@ -60,3 +60,23 @@
60
60
  <%= form.check_box :list, { :onChange => 'form.submit()' } %>
61
61
  <%= form.label :list, t(:list) %>
62
62
  </div>
63
+
64
+ <% if @dimensions.size == 1 &&
65
+ [SimpleDrilldown::Search::DisplayType::BAR, SimpleDrilldown::Search::DisplayType::PIE].include?(@search.display_type) %>
66
+ <%= javascript_tag do %>
67
+ $('#chart-1').on('click', function(e){
68
+ chart = Chartkick.charts['chart-1'].getChartObject();
69
+ firstPoint = chart.getElementsAtEvent(e)[0]
70
+ if (firstPoint) {
71
+ label = chart.data.labels[firstPoint._index];
72
+ value = chart.data.datasets[firstPoint._datasetIndex].data[firstPoint._index];
73
+ console.log("Label: " + label + ", Value: " + value);
74
+ new_location = window.location.toString();
75
+ new_location = new_location.replace("&search[dimensions][]=<%= @dimensions[0][:url_param_name] %>", '');
76
+ new_location = new_location + '&search[filter][<%= @dimensions[0][:url_param_name] %>][]=' + label;
77
+ console.log(new_location);
78
+ window.location = new_location;
79
+ }
80
+ });
81
+ <% end %>
82
+ <% end %>
@@ -22,7 +22,7 @@
22
22
  </tr>
23
23
  <% else %>
24
24
  <div class="form-group">
25
- <%= form.label "filter[#{dimension_name}]", t(dimension_name) %>
25
+ <%= form.label "filter[#{dimension_name}]", t(dimension_name, default: :"activerecord.models.#{dimension_name}") %>
26
26
  <%= select :search, :filter,
27
27
  choices,
28
28
  { :selected => @search.filter[dimension_name] },
@@ -122,7 +122,7 @@ module SimpleDrilldown
122
122
  interval: interval,
123
123
  label_method: label_method,
124
124
  legal_values: legal_values,
125
- pretty_name: I18n.t(name),
125
+ pretty_name: I18n.t(name, default: :"activerecord.models.#{name}"),
126
126
  queries: queries,
127
127
  reverse: reverse,
128
128
  select_expression: queries.size > 1 ? "COALESCE(#{queries.map { |q| q[:select] }.join(',')})" : queries[0][:select],
@@ -1,3 +1,3 @@
1
1
  module SimpleDrilldown
2
- VERSION = '0.6.3'
2
+ VERSION = '0.6.4'
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.3
4
+ version: 0.6.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: 2020-09-11 00:00:00.000000000 Z
11
+ date: 2020-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick