wice_grid 3.4.11 → 3.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19f365e429574298ed3b586c2517491ec3df7513
4
- data.tar.gz: 9e662dc2095c9885feb230952f881f3705cc12ee
3
+ metadata.gz: 413aebde3b5db88a0344afa85967a8cc20bf8b93
4
+ data.tar.gz: e5fb12b067ae1ab6f2b300be40c28ad5dc7b9b8e
5
5
  SHA512:
6
- metadata.gz: a47a53ef05c4a51972399a7f0d5adb74788a03637b2f334642d4e07fe5e8d418e665cb00b37e037d5e36d0548269ce8220f46f39e9cc9e779c7067a0958895d7
7
- data.tar.gz: a9160aef46162410f9420264c2fc102eb92ea23fa2f054cb1b5e8a7dec2a077f865a5ef8a3ea6d71998cad63fb08f59f7aeb6a0d9abb8af48e1307b5c29d9d27
6
+ metadata.gz: 583884d003c2c0f4c37337431576de5c0864aca77ee4599032aaf1906c5a863d58279ef9b9158650790ae6728eee65a08a494edf19bcc68ccdc3dfbeb559c4f9
7
+ data.tar.gz: 29520324979eadf2d8d3fa91a4ad3467630a4975e62ed17f498ae775e747956e49086d3ca7e9def66bb06d73f7b3a34d917ccc0eabeb02b488e260c02ceca09a
@@ -5,7 +5,9 @@ module Wice
5
5
 
6
6
  class ViewColumnDate < ViewColumnDatetime #:nodoc:
7
7
 
8
- @@datetime_chunk_names = %w(year month day)
8
+ def chunk_names
9
+ %w(year month day)
10
+ end
9
11
 
10
12
  def render_standard_filter_internal(params) #:nodoc:
11
13
  '<div class="date-filter">' +
@@ -16,7 +18,27 @@ module Wice
16
18
 
17
19
  end
18
20
 
19
- ConditionsGeneratorColumnDate = ConditionsGeneratorColumnDatetime #:nodoc:
21
+
22
+ class ConditionsGeneratorColumnDate < ConditionsGeneratorColumn #:nodoc:
23
+
24
+ def generate_conditions(table_alias, opts) #:nodoc:
25
+ conditions = [[]]
26
+ if opts[:fr]
27
+ conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} >= ? "
28
+ conditions << opts[:fr].to_date
29
+ end
30
+
31
+ if opts[:to]
32
+ conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} < ? "
33
+ conditions << (opts[:to].to_date + 1)
34
+ end
35
+
36
+ return false if conditions.size == 1
37
+
38
+ conditions[0] = conditions[0].join(' and ')
39
+ conditions
40
+ end
41
+ end
20
42
 
21
43
  end
22
44
 
@@ -15,11 +15,13 @@ module Wice
15
15
  options[:id] = options[:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
16
16
  end
17
17
 
18
- @@datetime_chunk_names = %w(year month day hour minute)
18
+ def chunk_names
19
+ %w(year month day hour minute)
20
+ end
19
21
 
20
22
  def prepare_for_standard_filter #:nodoc:
21
23
  x = lambda{|sym|
22
- @@datetime_chunk_names.collect{|datetime_chunk_name|
24
+ chunk_names.map{|datetime_chunk_name|
23
25
  triple = form_parameter_name_id_and_query(sym => {datetime_chunk_name => ''})
24
26
  [triple[0], triple[3]]
25
27
  }
@@ -122,12 +124,12 @@ module Wice
122
124
  conditions = [[]]
123
125
  if opts[:fr]
124
126
  conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} >= ? "
125
- conditions << opts[:fr].to_date
127
+ conditions << opts[:fr]
126
128
  end
127
129
 
128
130
  if opts[:to]
129
131
  conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} < ? "
130
- conditions << (opts[:to].to_date + 1)
132
+ conditions << (opts[:to])
131
133
  end
132
134
 
133
135
  return false if conditions.size == 1
@@ -494,15 +494,17 @@ module Wice
494
494
 
495
495
  grid.output_buffer << '</div>'
496
496
 
497
+
498
+
497
499
  if Rails.env.development?
498
- grid.output_buffer << javascript_tag(%/ window.onload = function(){ \n/ +
500
+ grid.output_buffer << javascript_tag(%/ $(document).ready(function(){ \n/ +
499
501
  %$ if (typeof(WiceGridProcessor) == "undefined"){\n$ +
500
502
  %$ alert("wice_grid.js not loaded, WiceGrid cannot proceed!\\n" +\n$ +
501
503
  %$ "Make sure that you have loaded wice_grid.js.\\n" +\n$ +
502
504
  %$ "Add line\\n//= require wice_grid.js\\n" +\n$ +
503
505
  %$ "to app/assets/javascripts/application.js")\n$ +
504
506
  %$ }\n$ +
505
- %$ } $)
507
+ %$ }) $)
506
508
  end
507
509
 
508
510
  grid.output_buffer
data/wice_grid.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wice_grid'
3
- s.version = '3.4.11'
3
+ s.version = '3.4.12'
4
4
  s.homepage = 'https://github.com/leikind/wice_grid'
5
- s.date = '2014-11-20'
5
+ s.date = '2014-12-31'
6
6
  s.summary = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.'
7
7
  s.description = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.' +
8
8
  'One of the goals of this plugin was to allow the programmer to define the contents of the cell by himself, ' +
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wice_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.11
4
+ version: 3.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Leikind
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari