simple_drilldown 0.8.3 → 0.9.4
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/_chart.html.erb +11 -9
- data/app/views/drilldown/_excel_record_list_xlsx.xlsx.axlsx +1 -1
- data/app/views/drilldown/_field.html.erb +13 -21
- data/app/views/drilldown/_record_list.html.erb +1 -1
- data/app/views/drilldown/_row_header.html.erb +4 -2
- data/app/views/drilldown/_tab_buttons.html.erb +3 -4
- data/app/views/drilldown/index.html.erb +10 -13
- data/app/views/layouts/simple_drilldown/application.html.erb +9 -12
- data/lib/simple_drilldown/controller.rb +7 -8
- data/lib/simple_drilldown/engine.rb +1 -1
- data/lib/simple_drilldown/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9258ecdeb91deb6d4a17a1a23e28f1e0e9cbf243588d9f40e057f93f16c0892
|
4
|
+
data.tar.gz: 5a6e71f4400c9259fe90a04420372adfd29982bede1aec6968d06050c44de9cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c84bcd765bdb3a7fd29a67a2401849ca065505ec888b0691f6a3b3b79cd94ad5db7a8a28a12b575f6ab6675e328209e7aaa0c13b43c52f65fe227312efaf2e41
|
7
|
+
data.tar.gz: b87a85a90e3843d4deed1aa9725e914622073e77cfdf02db5e771912bd457812a846298f171d4673ee9d6cdcf9154bd661c6a2cd651231503de227fef1422f52
|
@@ -16,6 +16,14 @@
|
|
16
16
|
end
|
17
17
|
%>
|
18
18
|
|
19
|
+
<%= render '/drilldown/tab_buttons', form: form %>
|
20
|
+
|
21
|
+
<div id="drilldown_area">
|
22
|
+
<h2><%= caption %></h2>
|
23
|
+
<h3><%= subcaption %></h3>
|
24
|
+
<br/>
|
25
|
+
</div>
|
26
|
+
|
19
27
|
<%
|
20
28
|
case @search.display_type
|
21
29
|
when SimpleDrilldown::Search::DisplayType::PIE
|
@@ -25,12 +33,6 @@
|
|
25
33
|
<%= column_chart data, height: '24rem' %>
|
26
34
|
<% when SimpleDrilldown::Search::DisplayType::LINE %>
|
27
35
|
<%= line_chart data, height: '24rem' %>
|
28
|
-
<% else %>
|
29
|
-
<div id="drilldown_area">
|
30
|
-
<h2><%= caption %></h2>
|
31
|
-
<h3><%= subcaption %></h3>
|
32
|
-
<br/>
|
33
|
-
</div>
|
34
36
|
<% end %>
|
35
37
|
|
36
38
|
<div id="drilldown_search_area" style="margin-left: auto; margin-right: auto; text-align: center">
|
@@ -66,10 +68,10 @@
|
|
66
68
|
<%= javascript_tag do %>
|
67
69
|
$('#chart-1').on('click', function(e){
|
68
70
|
chart = Chartkick.charts['chart-1'].getChartObject();
|
69
|
-
firstPoint = chart.
|
71
|
+
firstPoint = chart.getElementsAtEventForMode(e, 'nearest', { intersect: true }, false)[0]
|
70
72
|
if (firstPoint) {
|
71
|
-
label = chart.data.labels[firstPoint.
|
72
|
-
value = chart.data.datasets[firstPoint.
|
73
|
+
label = chart.data.labels[firstPoint.index];
|
74
|
+
value = chart.data.datasets[firstPoint.datasetIndex].data[firstPoint._index];
|
73
75
|
console.log("Label: " + label + ", Value: " + value);
|
74
76
|
new_location = window.location.toString();
|
75
77
|
new_location = new_location.replace(/#.*$/, '');
|
@@ -3,7 +3,7 @@
|
|
3
3
|
def excel_header_row(sheet)
|
4
4
|
padding_cells = @dimensions.empty? ? 1 : @dimensions.size
|
5
5
|
row = (1...(padding_cells - 1)).map { |_n| nil }
|
6
|
-
@search.fields.each_with_index { |field, _i| row << t(field) }
|
6
|
+
@search.fields.each_with_index { |field, _i| row << t(field, default: field.titleize) }
|
7
7
|
sheet.add_row row
|
8
8
|
end
|
9
9
|
|
@@ -1,28 +1,20 @@
|
|
1
1
|
<% if dimension_name == 'calendar_date' %>
|
2
2
|
<% dates = [*@search.filter[dimension_name]] %>
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<%= form.label "filter[calendar_date]", t(:to_date) %>
|
16
|
-
</td>
|
17
|
-
<td>
|
18
|
-
<input type="text" data-behaviour="datepicker" id="search_filter[to_<%= dimension_name %>]"
|
19
|
-
name="search[filter][<%= dimension_name %>][]" class="form-control" value="<%= dates[1] || dates[0] %>"
|
20
|
-
placeholder="yyyy-mm-dd"/>
|
21
|
-
</td>
|
22
|
-
</tr>
|
3
|
+
<div class="form-group">
|
4
|
+
<%= form.label "filter[calendar_date]", t(:from_date) %>
|
5
|
+
<input type="text" data-behaviour="datepicker" id="search_filter[from_<%= dimension_name %>]"
|
6
|
+
name="search[filter][<%= dimension_name %>][]" class="form-control date" value="<%= dates[0] %>"
|
7
|
+
placeholder="yyyy-mm-dd"/>
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
10
|
+
<%= form.label "filter[calendar_date]", t(:to_date) %>
|
11
|
+
<input type="text" data-behaviour="datepicker" id="search_filter[to_<%= dimension_name %>]"
|
12
|
+
name="search[filter][<%= dimension_name %>][]" class="form-control date" value="<%= dates[1] %>"
|
13
|
+
placeholder="yyyy-mm-dd"/>
|
14
|
+
</div>
|
23
15
|
<% else %>
|
24
16
|
<div class="form-group">
|
25
|
-
<%= form.label "filter[#{dimension_name}]", t(dimension_name, default: :"activerecord.models.#{dimension_name}") %>
|
17
|
+
<%= form.label "filter[#{dimension_name}]", t(dimension_name, default: [:"activerecord.models.#{dimension_name}", dimension_name.titleize]) %>
|
26
18
|
<%= select :search, :filter,
|
27
19
|
choices,
|
28
20
|
{ :selected => @search.filter[dimension_name] },
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<tr>
|
3
3
|
<td colspan="<%= controller.c_summary_fields.size + 1 %>">
|
4
4
|
<table id="drilldown-records-<%= result[:value] %>" class="table table-condensed table-bordered" style="padding-bottom: 10px;">
|
5
|
-
<%= render
|
5
|
+
<%= render '/drilldown/row_header', records: result[:records] %>
|
6
6
|
<tbody>
|
7
7
|
<% result[:records].each do |t| %>
|
8
8
|
<%= render :partial => '/drilldown/row', :locals => { :transaction => t, :previous_transaction => nil, :errors => [], :error_row => false, :meter1_errors => false } %>
|
@@ -1,8 +1,10 @@
|
|
1
1
|
<thead>
|
2
2
|
<tr>
|
3
3
|
<% @search.fields.each do |field| %>
|
4
|
-
<th><%=t field, default: :"attributes.#{field}" %></th>
|
4
|
+
<th><%= t field, default: :"attributes.#{field}" %></th>
|
5
5
|
<% end %>
|
6
|
-
<th
|
6
|
+
<th>
|
7
|
+
<%= render 'drilldown/export_links', records: records %>
|
8
|
+
</th>
|
7
9
|
</tr>
|
8
10
|
</thead>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
<div
|
2
|
-
<%= form.submit t(:search), class: 'btn btn-
|
3
|
-
<a href="<%= url_for
|
1
|
+
<div class="float-right">
|
2
|
+
<%= form.submit t(:search), class: 'btn btn-primary' %>
|
3
|
+
<a href="<%= url_for %>" class="btn btn-warning"><%= t :reset %></a>
|
4
4
|
</div>
|
5
|
-
<br clear="right"/>
|
@@ -1,16 +1,15 @@
|
|
1
|
-
<% @page_title = "#{caption} #{subcaption}" %>
|
2
1
|
<%= javascript_include_tag 'chartkick' %>
|
3
2
|
<%= stylesheet_link_tag 'simple_drilldown/application' %>
|
4
|
-
<style
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
<style>
|
4
|
+
table#drill_down_layout > tbody > tr > td {
|
5
|
+
border: none;
|
6
|
+
font-size: 13px
|
7
|
+
}
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
table#drill_down_layout td {
|
10
|
+
padding: 2px;
|
11
|
+
line-height: 18px
|
12
|
+
}
|
14
13
|
</style>
|
15
14
|
|
16
15
|
<%= form_for @search, html: { id: 'edit_search_SEARCH', method: :get, class: :search, style: 'background: inherit', onsubmit: 'return this.submit()' }, url: {} do |form| %>
|
@@ -26,11 +25,9 @@
|
|
26
25
|
<!-- Tab panes -->
|
27
26
|
<div class="tab-content">
|
28
27
|
<div class="tab-pane active" id="filter">
|
29
|
-
<%= render '/drilldown/tab_buttons', form: form %>
|
30
28
|
<%= render '/drilldown/filter', form: form %>
|
31
29
|
</div>
|
32
30
|
<div class="tab-pane" id="fields">
|
33
|
-
<%= render '/drilldown/tab_buttons', form: form %>
|
34
31
|
<%= render '/drilldown/fields', form: form %>
|
35
32
|
</div>
|
36
33
|
</div>
|
@@ -46,7 +43,7 @@
|
|
46
43
|
<div class="row">
|
47
44
|
<div class="col-md-12" valign="top">
|
48
45
|
<div style="float: right; clear: both;">
|
49
|
-
<%= render '/drilldown/export_links' %>
|
46
|
+
<%= render '/drilldown/export_links', records: @result[:records] %>
|
50
47
|
</div>
|
51
48
|
<%= render '/drilldown/summary_table' %>
|
52
49
|
</div>
|
@@ -1,15 +1,12 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<%= yield %>
|
13
|
-
|
14
|
-
</body>
|
3
|
+
<head>
|
4
|
+
<title>Simple drilldown</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
<%= stylesheet_link_tag "simple_drilldown/application", media: "all" %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<%= yield %>
|
11
|
+
</body>
|
15
12
|
</html>
|
@@ -45,8 +45,8 @@ module SimpleDrilldown
|
|
45
45
|
self.c_base_condition = base_condition
|
46
46
|
end
|
47
47
|
|
48
|
-
def base_includes(base_includes)
|
49
|
-
self.c_base_includes = base_includes
|
48
|
+
def base_includes(*base_includes)
|
49
|
+
self.c_base_includes = base_includes.flatten
|
50
50
|
end
|
51
51
|
|
52
52
|
def base_group(base_group)
|
@@ -69,7 +69,7 @@ module SimpleDrilldown
|
|
69
69
|
self.c_select = select
|
70
70
|
end
|
71
71
|
|
72
|
-
def list_includes(list_includes)
|
72
|
+
def list_includes(*list_includes)
|
73
73
|
self.c_list_includes = list_includes.flatten
|
74
74
|
end
|
75
75
|
|
@@ -128,7 +128,7 @@ module SimpleDrilldown
|
|
128
128
|
interval: interval,
|
129
129
|
label_method: label_method,
|
130
130
|
legal_values: legal_values,
|
131
|
-
pretty_name: I18n.t(name, default: :"activerecord.models.#{name}"),
|
131
|
+
pretty_name: I18n.t(name, default: [:"activerecord.models.#{name}", name.to_s.titleize]),
|
132
132
|
queries: queries,
|
133
133
|
reverse: reverse,
|
134
134
|
select_expression:
|
@@ -192,9 +192,6 @@ module SimpleDrilldown
|
|
192
192
|
|
193
193
|
values = Array(values)
|
194
194
|
if dimension_def[:interval]
|
195
|
-
values *= 2 if values.size == 1
|
196
|
-
raise "Need 2 values for interval filter: #{values.inspect}" if values.size != 2
|
197
|
-
|
198
195
|
if values[0].present? && values[1].present?
|
199
196
|
condition_strings << "#{dimension_def[:select_expression]} BETWEEN ? AND ?"
|
200
197
|
condition_values += values
|
@@ -263,7 +260,9 @@ module SimpleDrilldown
|
|
263
260
|
include_alias = include.to_s.pluralize
|
264
261
|
case ass.macro
|
265
262
|
when :belongs_to
|
266
|
-
|
263
|
+
pk_col = ass.association_primary_key
|
264
|
+
fk_col = ass.options[:foreign_key] || "#{include}_id"
|
265
|
+
"LEFT JOIN #{include_table} #{include_alias} ON #{include_alias}.#{pk_col} = #{model_table}.#{fk_col}"
|
267
266
|
when :has_one, :has_many
|
268
267
|
fk_col = ass.options[:foreign_key] || "#{model}_id"
|
269
268
|
sql = +"LEFT JOIN #{include_table} #{include_alias} ON #{include_alias}.#{fk_col} = #{model_table}.id"
|
@@ -9,7 +9,7 @@ module SimpleDrilldown
|
|
9
9
|
config.autoload_paths << File.dirname(__dir__)
|
10
10
|
|
11
11
|
initializer 'simple_drilldown.assets.precompile' do |app|
|
12
|
-
app.config.assets.precompile += %w[chartkick.js]
|
12
|
+
app.config.assets.precompile += %w[simple_drilldown/application.css chartkick.js]
|
13
13
|
end
|
14
14
|
|
15
15
|
ActionDispatch::Routing::Mapper.include SimpleDrilldown::Routing
|
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.9.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: 2021-05-
|
11
|
+
date: 2021-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caxlsx_rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
|
-
rubygems_version: 3.2.
|
173
|
+
rubygems_version: 3.2.15
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Simple data warehouse and drilldown.
|