query_report 1.0.21 → 1.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +60 -38
- data/app/assets/javascripts/query_report.js.coffee +9 -0
- data/app/helpers/{query_report_filter_helper.rb → query_report_engine_filter_helper.rb} +1 -1
- data/app/helpers/{query_report_helper.rb → query_report_engine_helper.rb} +6 -1
- data/app/helpers/{query_report_link_helper.rb → query_report_engine_link_helper.rb} +1 -1
- data/app/views/query_report/_search.html.erb +1 -1
- data/app/views/query_report/list.html.erb +1 -1
- data/lib/query_report/filter.rb +1 -1
- data/lib/query_report/helper.rb +20 -5
- data/lib/query_report/record.rb +6 -5
- data/lib/query_report/version.rb +1 -1
- metadata +25 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aa6a5e9dbe15e1632dbb248e0340f5f2f71ec04
|
4
|
+
data.tar.gz: b23adc6f5cdf706aacde613736e66fd129e6d9e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fffad0b223b647ba449c4d8c6300f8b1937fdd9d2a0579281fea0fe8acf2e2174c375ffb20abacd03c07d3f9d2d349635b332c7827b90da802a3430d7bfb6b82
|
7
|
+
data.tar.gz: c46a56e3081e5e29b854161c2bd84c3248e4eb4cf3aa5a9d17f5af8df3b4f2ef15709fbaddc28f52265fd0baca0c7c80c9b6a33bacc20e15932d44a842c374a3
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ end
|
|
54
54
|
```
|
55
55
|
|
56
56
|
## License
|
57
|
-
MIT License. Copyright ©
|
57
|
+
MIT License. Copyright © 2014 [Ashrafuzzaman](http://ashrafuzzaman.github.io). See MIT-LICENSE for further details.
|
58
58
|
|
59
59
|
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ashrafuzzaman/query_report/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
60
60
|
|
data/Rakefile
CHANGED
@@ -1,51 +1,73 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'QueryReport'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.md')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
-
load 'rails/tasks/engine.rake'
|
2
|
+
# encoding: utf-8
|
25
3
|
|
4
|
+
require 'bundler'
|
5
|
+
Bundler::GemHelper.install_tasks
|
26
6
|
|
7
|
+
require 'rspec/core'
|
8
|
+
require 'rspec/core/rake_task'
|
27
9
|
|
28
|
-
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
11
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
12
|
+
end
|
29
13
|
|
30
|
-
#
|
14
|
+
# task :default => "spec:all"
|
31
15
|
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#end
|
16
|
+
# namespace :spec do
|
17
|
+
# desc "Run Tests against all ORMs"
|
18
|
+
# task :all do
|
19
|
+
# sh "bundle --quiet"
|
20
|
+
# sh "bundle exec rake spec"
|
21
|
+
# end
|
22
|
+
# end
|
38
23
|
#
|
24
|
+
# begin
|
25
|
+
# require 'rdoc/task'
|
39
26
|
#
|
40
|
-
#
|
27
|
+
# Rake::RDocTask.new do |rdoc|
|
28
|
+
# require 'query_report/version'
|
29
|
+
#
|
30
|
+
# rdoc.rdoc_dir = 'rdoc'
|
31
|
+
# rdoc.title = "query report #{QueryReport::VERSION}"
|
32
|
+
# rdoc.rdoc_files.include('README*')
|
33
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
# end
|
35
|
+
# rescue LoadError
|
36
|
+
# puts 'RDocTask is not supported on this VM and platform combination.'
|
37
|
+
# end
|
41
38
|
|
39
|
+
task :default => "spec:all"
|
40
|
+
gemfiles = %w(active_record_32 active_record_4)
|
42
41
|
|
43
|
-
|
44
|
-
|
42
|
+
namespace :spec do
|
43
|
+
gemfiles.each do |gemfile|
|
44
|
+
desc "Run Tests against #{gemfile}"
|
45
|
+
task gemfile do
|
46
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
47
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake -t spec"
|
48
|
+
end
|
49
|
+
end
|
45
50
|
|
46
|
-
|
51
|
+
desc "Run Tests against all ORMs"
|
52
|
+
task :all do
|
53
|
+
gemfiles.each do |gemfile|
|
54
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
55
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
47
59
|
|
48
|
-
|
49
|
-
task
|
60
|
+
begin
|
61
|
+
require 'rdoc/task'
|
50
62
|
|
51
|
-
|
63
|
+
Rake::RDocTask.new do |rdoc|
|
64
|
+
require 'query_report/version'
|
65
|
+
|
66
|
+
rdoc.rdoc_dir = 'rdoc'
|
67
|
+
rdoc.title = "Query report #{QueryReport::VERSION}"
|
68
|
+
rdoc.rdoc_files.include('README*')
|
69
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
70
|
+
end
|
71
|
+
rescue LoadError
|
72
|
+
puts 'RDocTask is not supported on this VM and platform combination.'
|
73
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class @QueryReport
|
2
|
+
@sendEmail: (email_to, subject, message) =>
|
3
|
+
searchForm = $("div.query_report:visible form")
|
4
|
+
searchForm.find("#send_as_email").val(1)
|
5
|
+
searchForm.find("#email_to").val(email_to)
|
6
|
+
searchForm.find("#subject").val(subject)
|
7
|
+
searchForm.find("#message").val(message)
|
8
|
+
searchForm.submit()
|
9
|
+
searchForm.find("#send_as_email").val(0) #reseting the email back to false
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'query_report/errors'
|
2
2
|
|
3
|
-
module
|
3
|
+
module QueryReportEngineHelper
|
4
4
|
def query_report_render_filter(filter, comparator)
|
5
5
|
hint = comparator.name
|
6
6
|
search_tag_name = comparator.search_tag_name
|
@@ -16,6 +16,11 @@ module QueryReportHelper
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def render_query_report(report = nil)
|
20
|
+
report ||= @report
|
21
|
+
render :partial => "query_report/list", locals: {report: report}
|
22
|
+
end
|
23
|
+
|
19
24
|
def export_report_url_with_format(format)
|
20
25
|
url_for(params.merge(format: format))
|
21
26
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= search_form_for report.search, url: url_for, remote: @remote, html: {:method => :get, :class => 'form-inline'} do |f| %>
|
1
|
+
<%= search_form_for report.search, url: url_for({}), remote: @remote, html: {:method => :get, :class => 'form-inline'} do |f| %>
|
2
2
|
<% report.filters.each do |filter| %>
|
3
3
|
<% filter.comparators.each do |comparator| %>
|
4
4
|
<%= query_report_render_filter(filter, comparator) %>
|
@@ -1 +1 @@
|
|
1
|
-
<%=
|
1
|
+
<%= render_query_report(@report) %>
|
data/lib/query_report/filter.rb
CHANGED
@@ -30,7 +30,7 @@ module QueryReport
|
|
30
30
|
def apply_filters(query, http_params)
|
31
31
|
# apply default filter
|
32
32
|
params = load_default_values_in_param(http_params) #need for ransack filter
|
33
|
-
@search = query.
|
33
|
+
@search = query.ransack(params[:q])
|
34
34
|
query = @search.result
|
35
35
|
|
36
36
|
#apply custom filter
|
data/lib/query_report/helper.rb
CHANGED
@@ -9,11 +9,19 @@ require 'query_report/report_pdf'
|
|
9
9
|
|
10
10
|
module QueryReport
|
11
11
|
module Helper
|
12
|
+
|
13
|
+
# Generates the reports
|
14
|
+
# Params:
|
15
|
+
# query - The base query that the reporter with start with [filters will be applied on it]
|
16
|
+
# options - Options for the reports
|
17
|
+
# :custom_view - by default false, if set to true then the reporter will look for the file to render
|
18
|
+
# :skip_rendering - by default false, if set to true then the reporter will not render any thing, you will have to implement the rendering
|
12
19
|
def reporter(query, options={}, &block)
|
13
20
|
@report ||= QueryReport::Report.new(params, view_context, options)
|
14
21
|
@report.query = query
|
15
22
|
@report.instance_eval &block
|
16
|
-
render_report(options)
|
23
|
+
render_report(options) unless options[:skip_rendering]
|
24
|
+
@report
|
17
25
|
end
|
18
26
|
|
19
27
|
def render_report(options)
|
@@ -23,11 +31,18 @@ module QueryReport
|
|
23
31
|
|
24
32
|
@remote = false
|
25
33
|
respond_to do |format|
|
26
|
-
|
27
|
-
|
28
|
-
|
34
|
+
if options[:custom_view]
|
35
|
+
format.js do
|
36
|
+
@remote = true
|
37
|
+
end
|
38
|
+
format.html
|
39
|
+
else
|
40
|
+
format.js do
|
41
|
+
@remote = true
|
42
|
+
render 'query_report/list'
|
43
|
+
end
|
44
|
+
format.html { render('query_report/list') }
|
29
45
|
end
|
30
|
-
format.html { render 'query_report/list' }
|
31
46
|
format.json { render json: @report.all_records }
|
32
47
|
format.csv { send_data generate_csv_for_report(@report.all_records), :disposition => "attachment;" }
|
33
48
|
format.pdf { send_data pdf_for_report(options), :type => 'application/pdf', :disposition => 'inline' }
|
data/lib/query_report/record.rb
CHANGED
@@ -43,11 +43,6 @@ module QueryReport
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def sanitize_value(data, render_from_view)
|
47
|
-
data = strip_tags(data) if !render_from_view && data.present? && data.is_a?(String)
|
48
|
-
data
|
49
|
-
end
|
50
|
-
|
51
46
|
def has_any_rowspan?
|
52
47
|
@has_any_rowspan = @columns.any?(&:rowspan?) if @has_any_rowspan.nil?
|
53
48
|
@has_any_rowspan
|
@@ -99,5 +94,11 @@ module QueryReport
|
|
99
94
|
def content_from_element(content)
|
100
95
|
content.kind_of?(Hash) ? content[:content] : content
|
101
96
|
end
|
97
|
+
|
98
|
+
private
|
99
|
+
def sanitize_value(data, render_from_view)
|
100
|
+
data = strip_tags(data) if !render_from_view && data.present? && data.is_a?(String)
|
101
|
+
data
|
102
|
+
end
|
102
103
|
end
|
103
104
|
end
|
data/lib/query_report/version.rb
CHANGED
metadata
CHANGED
@@ -1,99 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: query_report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- A.K.M. Ashrafuzzaman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3
|
19
|
+
version: '3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3
|
26
|
+
version: '3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ransack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.0.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: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: google_visualr
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rmagick
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.13.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.13.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gruff
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.5.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.5.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: kaminari
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.14.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.14.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: prawn
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,34 +122,6 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: jquery-rails
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: bullet
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
125
|
- !ruby/object:Gem::Dependency
|
154
126
|
name: rspec
|
155
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,20 +178,6 @@ dependencies:
|
|
206
178
|
- - ">="
|
207
179
|
- !ruby/object:Gem::Version
|
208
180
|
version: 1.2.0
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: capybara
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '1.0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '1.0'
|
223
181
|
description: This is a gem to help you to structure common reports of you application
|
224
182
|
just by writing in the controller
|
225
183
|
email:
|
@@ -231,9 +189,10 @@ files:
|
|
231
189
|
- MIT-LICENSE
|
232
190
|
- README.md
|
233
191
|
- Rakefile
|
234
|
-
- app/
|
235
|
-
- app/helpers/
|
236
|
-
- app/helpers/
|
192
|
+
- app/assets/javascripts/query_report.js.coffee
|
193
|
+
- app/helpers/query_report_engine_filter_helper.rb
|
194
|
+
- app/helpers/query_report_engine_helper.rb
|
195
|
+
- app/helpers/query_report_engine_link_helper.rb
|
237
196
|
- app/mailers/report_mailer.rb
|
238
197
|
- app/views/query_report/_chart.html.erb
|
239
198
|
- app/views/query_report/_charts.html.erb
|