query_report 1.1.4 → 1.1.5

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: 1978b909b698bc2036b896976c1b074499b2dfa5
4
- data.tar.gz: 90042aeecc659357ec1771b8d49d2b199291bf98
3
+ metadata.gz: d6b3f40965b5012204df0d2d2a6f82cc294258eb
4
+ data.tar.gz: 603db01eab6734ea27b0a25480fb6efdee509f0d
5
5
  SHA512:
6
- metadata.gz: b3dd25570a3f79771553d23324b141455bd9ca0e90e10090028c659a138ad17b49382b662eb69affba9591015f7a8517a19361477e5738a7606fc3f2213a8650
7
- data.tar.gz: a186b2d6b2e78482b664fb66ccf3b06d3aefd002b16299b7c1e5aa53d4cd330a2f0ff6377eb8ceb844a38ba66cfeab0e1671ec5e810ee46cc0c43dbc3250f085
6
+ metadata.gz: 8a2c6b44148de44d12a78bd40b0f5c4a86b0f4b343c27ed673c95943d05b0c7621c977db781702bc860b8d17abccfa3580e56413b0c64bb13d71f2a5fcab81d9
7
+ data.tar.gz: cb5b9506ae29a757f9cac6bf3425c1790dedee91a61103a232872b6e8914809a712315110d0c99930a4694f702c13fa7f2a1e6353c816d7f9284e7801e2f56dc
@@ -1,3 +1,7 @@
1
+ require 'active_support/core_ext/object/to_query'
2
+ require 'action_view'
3
+ require 'action_view/helpers'
4
+ require 'rack/utils'
1
5
  require 'query_report/errors'
2
6
 
3
7
  module QueryReportEngineHelper
@@ -30,4 +34,16 @@ module QueryReportEngineHelper
30
34
  def export_report_url_with_format(format)
31
35
  url_for(params.merge(format: format))
32
36
  end
37
+
38
+ def hash_to_hidden_fields(hash)
39
+ cleaned_hash = hash.reject { |k, v| v.nil? }
40
+ pairs = cleaned_hash.to_query.split(Rack::Utils::DEFAULT_SEP)
41
+
42
+ tags = pairs.map do |pair|
43
+ key, value = pair.split('=', 2).map { |str| Rack::Utils.unescape(str) }
44
+ hidden_field_tag(key, value)
45
+ end
46
+
47
+ tags.join("\n").html_safe
48
+ end
33
49
  end
@@ -1,5 +1,10 @@
1
+ <% params_for_url = params
2
+ params_for_url.delete(:q)
3
+ params_for_url.delete(:custom_search) %>
4
+
1
5
  <%= search_form_for report.search, url: url_for({}), remote: @remote,
2
6
  html: (QueryReport.config.search_form_options || {}).merge(method: :get) do |f| %>
7
+ <%= hash_to_hidden_fields params_for_url %>
3
8
  <% report.filters.each do |filter| %>
4
9
  <% filter.comparators.each do |comparator| %>
5
10
  <%= query_report_render_filter(filter, comparator) %>
@@ -1,3 +1,3 @@
1
1
  module QueryReport
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
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.4
4
+ version: 1.1.5
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-07-09 00:00:00.000000000 Z
11
+ date: 2014-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties