query_report 1.1.1 → 1.1.2

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: 6d0461f6e9e28d8ae3b6f2f6dd661c3a3e6f387d
4
- data.tar.gz: 6567d8bd870bdb828092433c696235c3ea224f09
3
+ metadata.gz: 43187b542e2b2f2fe34fd7e25b489b50227fee5f
4
+ data.tar.gz: 8fdff9153ed76142aa42d7af7f8d5e4b892fbb75
5
5
  SHA512:
6
- metadata.gz: 45f9063e2482cda3faf2f05dab9aa8f3bfb62688a9d81bbb6d861a30bcd786a23352e9c6f9f42b5bfecd085423dd3c26ac2da39116bc299acb8f0c1219d72c43
7
- data.tar.gz: 20d34bbfc7f21995235dadf79b59a1dd2898c6f60a2a0989b7e45a521f04383b7a76372fa48875225270ce50a6167b97cf663bc46f754095d176459643dfabf5
6
+ metadata.gz: 27ec5569dbd669ce8accbe73eab9b9f5cd96419817f7b77b30d64b9222da118134d44950db950a913e65159aa6116f80ba06ce00882e379a4c470378adacf534
7
+ data.tar.gz: e089420de5bc97df677c94af2ce4e1da51d3ab4d8bc28582c15f468cbe823b674dec1b166be350630e4dbec8e77f3b7b2c6ce001152bedcc81f85a5afd5101cb
@@ -1,17 +1,17 @@
1
1
  module QueryReportEngineFilterHelper
2
- def query_report_text_filter(name, value, options={})
2
+ def query_report_default_text_filter(name, value, options={})
3
3
  text_field_tag name, value, options
4
4
  end
5
5
 
6
- def query_report_date_filter(name, value, options={})
6
+ def query_report_default_date_filter(name, value, options={})
7
7
  text_field_tag name, value, options.merge(class: :date)
8
8
  end
9
9
 
10
- def query_report_datetime_filter(name, value, options={})
10
+ def query_report_default_datetime_filter(name, value, options={})
11
11
  text_field_tag name, value, options.merge(class: :datetime)
12
12
  end
13
13
 
14
- def query_report_boolean_filter(name, value, options={})
14
+ def query_report_default_boolean_filter(name, value, options={})
15
15
  concat(label_tag options[:placeholder])
16
16
  select_tag name, options_for_select([['', ''], ['true', 'true'], ['false', 'false']], value)
17
17
  end
@@ -7,12 +7,18 @@ module QueryReportEngineHelper
7
7
  value = comparator.param_value
8
8
 
9
9
  method_name = :"query_report_#{filter.type.to_s}_filter"
10
- if main_app.respond_to? method_name
11
- main_app.send method_name, search_tag_name, value, :placeholder => hint
12
- elsif self.respond_to? method_name
13
- self.send method_name, search_tag_name, value, :placeholder => hint
10
+ default_method_name = :"query_report_default_#{filter.type.to_s}_filter"
11
+ if respond_to? method_name
12
+ send method_name, search_tag_name, value, :placeholder => hint
13
+ elsif respond_to? default_method_name
14
+ send default_method_name, search_tag_name, value, :placeholder => hint
14
15
  else
15
- raise QueryReport::FilterNotDefined, "#{filter.type.to_s} filter is not defined"
16
+ raise QueryReport::FilterNotDefined, %Q{#{filter.type.to_s} filter is not defined.
17
+ Please define a method as following,
18
+ def #{method_name}(name, value, options={})
19
+ text_field_tag name, value, options
20
+ end
21
+ }
16
22
  end
17
23
  end
18
24
 
@@ -1,13 +1,25 @@
1
1
  module QueryReportEngineLinkHelper
2
- def link_to_download_report_pdf
3
- link_to t('views.links.pdf'), export_report_url_with_format('pdf'), :target => "_blank"
2
+ def link_to_default_download_report_pdf
3
+ if respond_to? :link_to_download_report_pdf
4
+ link_to_download_report_pdf
5
+ else
6
+ link_to t('views.links.pdf'), export_report_url_with_format('pdf'), :target => "_blank"
7
+ end
4
8
  end
5
9
 
6
- def link_to_download_report_csv
7
- link_to t('views.links.csv'), export_report_url_with_format('csv'), :target => "_blank"
10
+ def link_to_default_download_report_csv
11
+ if respond_to? :link_to_download_report_csv
12
+ link_to_download_report_csv
13
+ else
14
+ link_to t('views.links.csv'), export_report_url_with_format('csv'), :target => "_blank"
15
+ end
8
16
  end
9
17
 
10
- def link_to_email_query_report(target_dom_id)
11
- link_to t('views.labels.email'), 'javascript:void(0)', :onclick => "QueryReportEmail.openEmailModal('#{target_dom_id}');" if QueryReport.config.allow_email_report
18
+ def link_to_default_email_query_report(target_dom_id)
19
+ if respond_to? :link_to_email_query_report
20
+ link_to_email_query_report(target_dom_id)
21
+ else
22
+ link_to t('views.labels.email'), 'javascript:void(0)', :onclick => "QueryReportEmail.openEmailModal('#{target_dom_id}');" if QueryReport.config.allow_email_report
23
+ end
12
24
  end
13
25
  end
@@ -1,3 +1,3 @@
1
- <%= link_to_download_report_pdf %>
2
- <%= link_to_download_report_csv %>
3
- <%= link_to_email_query_report(@target_dom_id) %>
1
+ <%= link_to_default_download_report_pdf %>
2
+ <%= link_to_default_download_report_csv %>
3
+ <%= link_to_default_email_query_report(@target_dom_id) %>
@@ -21,15 +21,14 @@ module QueryReport
21
21
  @chart_type = chart_type
22
22
  @chart = "Chartify::#{chart_type.to_s.camelize}Chart".constantize.new
23
23
  @chart.title = chart_title
24
- # do |chart|
25
- # chart.data = [{hours_remain: 100, estimated_hours_remain: 100, day: 3.days.ago.to_date},
26
- # {hours_remain: 50, estimated_hours_remain: 45, day: 2.days.ago.to_date},
27
- # {hours_remain: 5, estimated_hours_remain: 10, day: 1.days.ago.to_date}]
28
- # chart.columns = {hours_remain: 'Hours remaining', estimated_hours_remain: 'Estimated hours remaining'}
29
- # chart.label_column = :day
30
- # end
31
24
  end
32
25
 
26
+ def sum_with(options)
27
+ @chart.data = []
28
+ options.each do |column_title, column|
29
+ @chart.data << [column_title, query.sum(column)]
30
+ end
31
+ end
33
32
  end
34
33
  end
35
34
  end
@@ -1,3 +1,3 @@
1
1
  module QueryReport
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
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-06-29 00:00:00.000000000 Z
11
+ date: 2014-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -104,30 +104,30 @@ dependencies:
104
104
  name: prawn
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
107
+ - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: '1.0'
109
+ version: 1.0.0
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - "~>"
114
+ - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: '1.0'
116
+ version: 1.0.0
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: chartify
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - "~>"
121
+ - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: '0.2'
123
+ version: 0.2.1
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: '0.2'
130
+ version: 0.2.1
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rake
133
133
  requirement: !ruby/object:Gem::Requirement