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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c8c81573f3c058802d4e0f5c79b1ac71e86df64
4
- data.tar.gz: 703e69202bc42844c1a87445cdb61e832936c309
3
+ metadata.gz: 8aa6a5e9dbe15e1632dbb248e0340f5f2f71ec04
4
+ data.tar.gz: b23adc6f5cdf706aacde613736e66fd129e6d9e2
5
5
  SHA512:
6
- metadata.gz: 0e1aa0d0d9609ec2d46087ddadea6be908da1b6c11847286e8cb02b500c308381f08172fd09bc268f47acefa423f6ea593981785dcfb368e482f2336be64dc76
7
- data.tar.gz: f05c03a9b18a4ce9554ddfa30cdd3eb2d7a9f1a605acaa048798d3955ab3a1b22b9684d28de72f5aa3a36099681de39e8329d488437acc1520dc43b78a23b6e2
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 © 2013 [Ashrafuzzaman](http://ashrafuzzaman.github.io). See MIT-LICENSE for further details.
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
- begin
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
- Bundler::GemHelper.install_tasks
10
+ RSpec::Core::RakeTask.new(:spec) do |spec|
11
+ spec.pattern = FileList['spec/**/*_spec.rb']
12
+ end
29
13
 
30
- #require 'rake/testtask'
14
+ # task :default => "spec:all"
31
15
  #
32
- #Rake::TestTask.new(:test) do |t|
33
- # t.libs << 'lib'
34
- # t.libs << 'test'
35
- # t.pattern = 'test/**/*_test.rb'
36
- # t.verbose = false
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
- #task :default => :test
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
- require "bundler/gem_tasks"
44
- require "rspec/core/rake_task"
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
- RSpec::Core::RakeTask.new
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
- task :default => :spec
49
- task :test => :spec
60
+ begin
61
+ require 'rdoc/task'
50
62
 
51
- task :default => :test
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,4 +1,4 @@
1
- module QueryReportFilterHelper
1
+ module QueryReportEngineFilterHelper
2
2
  def query_report_text_filter(name, value, options={})
3
3
  text_field_tag name, value, options
4
4
  end
@@ -1,6 +1,6 @@
1
1
  require 'query_report/errors'
2
2
 
3
- module QueryReportHelper
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
- module QueryReportLinkHelper
1
+ module QueryReportEngineLinkHelper
2
2
  def link_to_download_report_pdf
3
3
  link_to t('views.links.pdf'), export_report_url_with_format('pdf'), :target => "_blank"
4
4
  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
- <%= render :partial => "query_report/list", locals: {report: @report} %>
1
+ <%= render_query_report(@report) %>
@@ -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.search(params[:q])
33
+ @search = query.ransack(params[:q])
34
34
  query = @search.result
35
35
 
36
36
  #apply custom filter
@@ -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
- format.js do
27
- @remote = true
28
- render 'query_report/list'
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' }
@@ -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
@@ -1,3 +1,3 @@
1
1
  module QueryReport
2
- VERSION = "1.0.21"
2
+ VERSION = "1.0.22"
3
3
  end
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.21
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-03-03 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
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.0.0
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: '0'
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: '0'
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: '2.1'
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: '2.1'
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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: '0'
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/helpers/query_report_filter_helper.rb
235
- - app/helpers/query_report_helper.rb
236
- - app/helpers/query_report_link_helper.rb
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