wice_grid 3.3.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 092a576a254b1d6d2e661f6f5b87f708c858f640
4
+ data.tar.gz: b742d69270656e4f21e56c0b30b79504da23b015
5
+ SHA512:
6
+ metadata.gz: 4e65ab3eecc3cbeb363fc3d2cbaf7a36638ef84ed305fb1f4e489f4094613ad5c100dff281a73216392269327f4da7e921daa7bc385381e2fb295fad9b99c923
7
+ data.tar.gz: e1be30d9b58d59bd9f4c03a000276921c1f56cacf85d1ed9a595533dbbf6516c516943aa29458e57d708ed5f40eae3e0e6e9d192dd6e37ed15ced71579f978c9
data/README.rdoc CHANGED
@@ -1,17 +1,27 @@
1
1
  = WiceGrid
2
2
 
3
- Version:: 3.3.1
3
+ Version:: 3.4.0
4
4
  Author:: Yuri Leikind
5
5
  Sources:: https://github.com/leikind/wice_grid/
6
6
  Examples online:: http://wicegrid.herokuapp.com
7
7
  News:: http://leikind.org/pages/wicegrid/
8
8
  Email:: "Yuri Leikind" <yuri.leikind at gmail dot com>
9
9
 
10
- FOR RAILS 3 USE VERSION 3.x
11
-
12
10
  FOR RAILS 2 USE VERSION 0.6 (https://github.com/leikind/wice_grid/tree/master).
13
11
 
12
+ FOR RAILS 3 USE VERSION 3.3.x
13
+
14
+ FOR RAILS 4 USE VERSION 3.4.x. However with WiceGrid 3.4.0 Rails 4 produdes the following deprecation message:
15
+
16
+ DEPRECATION WARNING: It looks like you are eager loading table(s) (one of: tasks, statuses) that are referenced in a string SQL snippet. For example:
17
+
18
+ Post.includes(:comments).where("comments.title = 'foo'")
19
+
20
+ Currently, Active Record recognizes the table in the string, and knows to JOIN the comments table to the query, rather than loading comments in a separate query. However, doing this without writing a full-blown SQL parser is inherently flawed. Since we don't want to write an SQL parser, we are removing this functionality. From now on, you must explicitly tell Active Record when you are referencing a table from a string:
21
+
22
+ Post.includes(:comments).where("comments.title = 'foo'").references(:comments)
14
23
 
24
+ This will be fixed in future versions of WiceGrid.
15
25
 
16
26
  == Intro
17
27
 
@@ -55,12 +55,23 @@ module Wice
55
55
  end
56
56
 
57
57
  module ClassMethods #:nodoc:
58
+
59
+ def _sanitize_sql_hash_for_conditions(attrs, default_table_name = self.table_name)
60
+ attrs = expand_hash_conditions_for_aggregates(attrs)
61
+
62
+ table = Arel::Table.new(table_name, arel_engine).alias(default_table_name)
63
+ ActiveRecord::PredicateBuilder.build_from_hash(self, attrs, table).map { |b|
64
+ connection.visitor.accept b
65
+ }.join(' AND ')
66
+ end
67
+
68
+
58
69
  def merge_conditions(*conditions) #:nodoc:
59
70
  segments = []
60
71
 
61
72
  conditions.each do |condition|
62
73
  unless condition.blank?
63
- sql = sanitize_sql(condition)
74
+ sql = condition.is_a?(Hash) ? _sanitize_sql_hash_for_conditions(condition) : sanitize_sql_array(condition)
64
75
  segments << sql unless sql.blank?
65
76
  end
66
77
  end
@@ -8,14 +8,27 @@ module Wice
8
8
  # Read section "Saving Queries How-To" in README for more details.
9
9
  def define_routes(map, controller)
10
10
  controller = controller.to_s
11
+ # if Rails.version[0..1] == '3.'
11
12
 
12
- map.match '/wice_grid_serialized_queries/:grid_name',
13
- :to => "#{controller}#create",
14
- :as => 'create_serialized_query'
13
+ # map.match '/wice_grid_serialized_queries/:grid_name',
14
+ # :to => "#{controller}#create",
15
+ # :as => 'create_serialized_query'
15
16
 
16
- map.match '/wice_grid_serialized_queries/:grid_name/:id',
17
- :to => "#{controller}#delete",
18
- :as => 'delete_serialized_query'
17
+ # map.match '/wice_grid_serialized_queries/:grid_name/:id',
18
+ # :to => "#{controller}#delete",
19
+ # :as => 'delete_serialized_query'
20
+
21
+ # else
22
+
23
+ map.post '/wice_grid_serialized_queries/:grid_name',
24
+ :to => "#{controller}#create",
25
+ :as => 'create_serialized_query'
26
+
27
+ map.post '/wice_grid_serialized_queries/:grid_name/:id',
28
+ :to => "#{controller}#delete",
29
+ :as => 'delete_serialized_query'
30
+
31
+ # end
19
32
  end
20
33
  end
21
34
 
@@ -46,7 +59,11 @@ module Wice
46
59
  end
47
60
  query_params.delete(:page)
48
61
 
49
- @saved_query = @query_store_model.new(:grid_name => @grid_name, :name => params[:query_name], :query => query_params)
62
+ @saved_query = @query_store_model.new
63
+
64
+ @saved_query.grid_name = @grid_name
65
+ @saved_query.name = params[:query_name]
66
+ @saved_query.query = query_params
50
67
 
51
68
  @saved_query.attributes = params[:extra] unless params[:extra].blank?
52
69
 
@@ -9,7 +9,7 @@ class WiceGridSerializedQuery < ActiveRecord::Base #:nodoc:
9
9
 
10
10
  def self.list(name, controller)
11
11
  conditions = {:grid_name => name}
12
- self.find(:all, :conditions => conditions)
12
+ self.where(conditions).load
13
13
  end
14
14
 
15
- end
15
+ end
data/lib/wice_grid.rb CHANGED
@@ -257,6 +257,7 @@ module Wice
257
257
  end
258
258
 
259
259
  @ar_options[:conditions] = klass.send(:merge_conditions, @status[:conditions], * @table_column_matrix.conditions )
260
+
260
261
  # conditions processed
261
262
 
262
263
  if (! opts[:skip_ordering]) && @status[:order]
@@ -402,7 +403,7 @@ module Wice
402
403
 
403
404
  # with this variant we get even those values which do not appear in the resultset
404
405
  def distinct_values_for_column(column) #:nodoc:
405
- res = column.model.find(:all, :select => "distinct #{column.name}", :order => "#{column.name} asc").collect{|ar|
406
+ res = column.model.select("distinct #{column.name}").order("#{column.name} asc").collect{|ar|
406
407
  ar[column.name]
407
408
  }.reject{|e| e.blank?}.map{|i|[i,i]}
408
409
  end
@@ -526,10 +527,10 @@ module Wice
526
527
  def resultset_without_paging_without_user_filters #:nodoc:
527
528
  form_ar_options
528
529
  @klass.unscoped do
529
- @relation.find(:all, :joins => @ar_options[:joins],
530
- :include => @ar_options[:include],
531
- :group => @ar_options[:group],
532
- :conditions => @options[:conditions])
530
+ @relation.joins(@ar_options[:joins]).
531
+ includes(@ar_options[:include]).
532
+ group(@ar_options[:group]).
533
+ where(@options[:conditions])
533
534
  end
534
535
  end
535
536
 
@@ -548,7 +549,7 @@ module Wice
548
549
 
549
550
  def resultset_without_paging_with_user_filters #:nodoc:
550
551
  @klass.unscoped do
551
- active_relation_for_resultset_without_paging_with_user_filters.find(:all)
552
+ active_relation_for_resultset_without_paging_with_user_filters.load
552
553
  end
553
554
  end
554
555
 
@@ -1,5 +1,4 @@
1
- jQuery ->
2
- initWiceGrid()
1
+ $(document).on 'page:load ready', -> initWiceGrid()
3
2
 
4
3
  initWiceGrid = ->
5
4
 
@@ -1,5 +1,5 @@
1
- jQuery ->
2
- savedQueriesInit()
1
+ $(document).on 'page:load ready', -> savedQueriesInit()
2
+
3
3
 
4
4
  savedQueriesInit = ->
5
5
 
data/wice_grid.gemspec CHANGED
@@ -1,10 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wice_grid'
3
- s.version = '3.3.1'
3
+ s.version = '3.4.0'
4
4
  s.homepage = 'https://github.com/leikind/wice_grid'
5
- s.date = '2013-08-04'
5
+ s.date = '2013-10-11'
6
6
  s.summary = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.'
7
- s.description = 'One of the goals of this plugin was to allow the programmer to define the contents of the cell by himself, ' +
7
+ s.description = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.' +
8
+ 'One of the goals of this plugin was to allow the programmer to define the contents of the cell by himself, ' +
8
9
  'just like one does when rendering a collection via a simple table (and this is what differentiates WiceGrid ' +
9
10
  'from various scaffolding solutions), but automate implementation of filters, ordering, paginations, CSV ' +
10
11
  'export, and so on. Ruby blocks provide an elegant means for this.'
metadata CHANGED
@@ -1,37 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wice_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
5
- prerelease:
4
+ version: 3.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Yuri Leikind
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-04 00:00:00.000000000 Z
11
+ date: 2013-10-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: kaminari
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.13.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.13.0
30
- description: One of the goals of this plugin was to allow the programmer to define
31
- the contents of the cell by himself, just like one does when rendering a collection
32
- via a simple table (and this is what differentiates WiceGrid from various scaffolding
33
- solutions), but automate implementation of filters, ordering, paginations, CSV export,
34
- and so on. Ruby blocks provide an elegant means for this.
27
+ description: A Rails grid plugin to create grids with sorting, pagination, and (automatically
28
+ generated) filters.One of the goals of this plugin was to allow the programmer to
29
+ define the contents of the cell by himself, just like one does when rendering a
30
+ collection via a simple table (and this is what differentiates WiceGrid from various
31
+ scaffolding solutions), but automate implementation of filters, ordering, paginations,
32
+ CSV export, and so on. Ruby blocks provide an elegant means for this.
35
33
  email: yuri.leikind@gmail.com
36
34
  executables: []
37
35
  extensions: []
@@ -106,25 +104,24 @@ files:
106
104
  homepage: https://github.com/leikind/wice_grid
107
105
  licenses:
108
106
  - MIT
107
+ metadata: {}
109
108
  post_install_message:
110
109
  rdoc_options: []
111
110
  require_paths:
112
111
  - lib
113
112
  required_ruby_version: !ruby/object:Gem::Requirement
114
- none: false
115
113
  requirements:
116
- - - ! '>='
114
+ - - '>='
117
115
  - !ruby/object:Gem::Version
118
116
  version: '0'
119
117
  required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
118
  requirements:
122
- - - ! '>='
119
+ - - '>='
123
120
  - !ruby/object:Gem::Version
124
121
  version: '0'
125
122
  requirements: []
126
123
  rubyforge_project:
127
- rubygems_version: 1.8.23
124
+ rubygems_version: 2.0.3
128
125
  signing_key:
129
126
  specification_version: 3
130
127
  summary: A Rails grid plugin to create grids with sorting, pagination, and (automatically