query_report 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
  <table class="<%= QueryReport.config.record_table_class %>" cellpadding="0" cellspacing="0">
3
3
  <thead>
4
4
  <% report.columns.each do |column| %>
5
- <th><%= column.sortable? ? sort_link(report.search, column.name, {}, remote: @remote) : column.humanize %></th>
5
+ <th><%= column.sortable? ? sort_link(report.search, column.name, params, remote: @remote) : column.humanize %></th>
6
6
  <% end %>
7
7
  </thead>
8
8
 
@@ -16,6 +16,8 @@ module QueryReport
16
16
  # +options+:: Options can have the following,
17
17
  # options[:type] => date | text | whatever
18
18
  # options[:comp] => the comparators used for ransack search, [:gteq, :lteq]
19
+ # options[:manual] => if set to true then that filter will not be applied, only will appear and can be used for custom application
20
+ # options[:default] => support default filter value, can be one value or for range filter can be array
19
21
  def filter(column, options={}, &block)
20
22
  @filters ||= []
21
23
  @filters << Filter.new(@params, column, options, &block)
@@ -35,7 +37,7 @@ module QueryReport
35
37
  @filters.select(&:custom?).each do |filter|
36
38
  ordered_custom_param_values = ordered_param_value_objects(filter)
37
39
  has_no_user_input = ordered_custom_param_values.all? { |p| p.nil? or p == '' }
38
- query = filter.block.call(query, *ordered_custom_param_values) unless has_no_user_input
40
+ query = filter.block.call(query, *ordered_custom_param_values) if filter.block and !has_no_user_input
39
41
  end
40
42
  query
41
43
  end
@@ -81,7 +83,7 @@ module QueryReport
81
83
  end
82
84
 
83
85
  def custom?
84
- @block ? true : false
86
+ @block || @options[:manual] == true ? true : false
85
87
  end
86
88
 
87
89
  def search_keys
@@ -1,3 +1,3 @@
1
1
  module QueryReport
2
- VERSION = "1.0.7"
2
+ VERSION = "1.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-06 00:00:00.000000000 Z
12
+ date: 2013-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails