wice_grid 3.2.1.pre2 → 3.2.1.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  = WiceGrid
2
2
 
3
- Version:: 3.2.1.pre2
3
+ Version:: 3.2.1.pre3
4
4
  Author:: Yuri Leikind
5
5
  Sources:: https://github.com/leikind/wice_grid/
6
6
  Examples online:: http://grid.leikind.org
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.1.pre2
1
+ 3.2.1.pre3
@@ -461,14 +461,14 @@ module Wice
461
461
  grid.output_buffer << '</div>'
462
462
 
463
463
  if Rails.env == 'development'
464
- grid.output_buffer << javascript_tag(%/ $(document).ready(function(){ \n/ +
464
+ grid.output_buffer << javascript_tag(%/ window.onload = function(){ \n/ +
465
465
  %$ if (typeof(WiceGridProcessor) == "undefined"){\n$ +
466
466
  %$ alert("wice_grid.js not loaded, WiceGrid cannot proceed!\\n" +\n$ +
467
467
  %$ "Make sure that you have loaded wice_grid.js.\\n" +\n$ +
468
468
  %$ "Add line\\n//= require wice_grid.js\\n" +\n$ +
469
469
  %$ "to app/assets/javascripts/application.js")\n$ +
470
470
  %$ }\n$ +
471
- %$ }) $)
471
+ %$ } $)
472
472
  end
473
473
 
474
474
  grid.output_buffer
@@ -623,20 +623,42 @@ module Wice
623
623
 
624
624
  collection = grid.resultset
625
625
 
626
- collection_total_entries = collection.total_count
626
+ if grid.all_record_mode?
627
+
628
+ collection_total_entries = collection.size
629
+ current_page = 1
630
+ per_page = collection_total_entries
631
+
632
+ first = 1
633
+ last = collection.size
634
+
635
+ num_pages = 1
636
+
637
+ class << collection
638
+ def current_page
639
+ 1
640
+ end
627
641
 
642
+ def total_pages
643
+ 1
644
+ end
645
+ end
628
646
 
629
- current_page = grid.ar_options[:page].to_i
630
- per_page = grid.ar_options[:per_page].to_i
647
+ else
648
+ collection_total_entries = collection.total_count
649
+ current_page = grid.ar_options[:page].to_i
650
+ per_page = grid.ar_options[:per_page].to_i
631
651
 
632
- first = collection.offset_value + 1
633
- last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
652
+ first = collection.offset_value + 1
653
+ last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
634
654
 
655
+ num_pages = collection.num_pages
656
+ end
635
657
 
636
658
  parameters = grid.get_state_as_parameter_value_pairs
637
659
 
638
660
  js = ''
639
- html = if (collection.num_pages < 2 && collection.length == 0)
661
+ html = if (num_pages < 2 && collection.length == 0)
640
662
  '0'
641
663
  else
642
664
  parameters << ["#{grid.name}[pp]", collection_total_entries]
@@ -265,21 +265,16 @@ module Wice
265
265
  @ar_options[:order] += ' ' + @status[:order_direction]
266
266
  end
267
267
 
268
- if self.output_html?
269
- @ar_options[:per_page] = if all_record_mode?
270
- # reset the :pp value in all records mode
271
- @status[:pp] = count_resultset_without_paging_without_user_filters
272
- else
273
- @status[:per_page]
274
- end
268
+ @ar_options[:joins] = @options[:joins]
269
+ @ar_options[:include] = @options[:include]
270
+ @ar_options[:group] = @options[:group]
275
271
 
272
+ if self.output_html?
273
+ @ar_options[:per_page] = @status[:per_page]
276
274
  @ar_options[:page] = @status[:page]
277
275
  @ar_options[:total_entries] = @status[:total_entries] if @status[:total_entries]
278
276
  end
279
277
 
280
- @ar_options[:joins] = @options[:joins]
281
- @ar_options[:include] = @options[:include]
282
- @ar_options[:group] = @options[:group]
283
278
  end
284
279
 
285
280
 
@@ -287,7 +282,7 @@ module Wice
287
282
  def read #:nodoc:
288
283
  form_ar_options
289
284
  @klass.unscoped do
290
- @resultset = if self.output_csv?
285
+ @resultset = if self.output_csv? || all_record_mode?
291
286
  # @relation.find(:all, @ar_options)
292
287
  @relation.
293
288
  includes(@ar_options[:include]).
@@ -538,17 +533,18 @@ module Wice
538
533
  end
539
534
  end
540
535
 
541
- def count_resultset_without_paging_without_user_filters #:nodoc:
542
- form_ar_options
543
- @klass.unscoped do
544
- @relation.count(
545
- :joins => @ar_options[:joins],
546
- :include => @ar_options[:include],
547
- :group => @ar_options[:group],
548
- :conditions => @options[:conditions]
549
- )
550
- end
551
- end
536
+ # not used right now
537
+ # def count_resultset_without_paging_without_user_filters #:nodoc:
538
+ # form_ar_options
539
+ # @klass.unscoped do
540
+ # @relation.count(
541
+ # :joins => @ar_options[:joins],
542
+ # :include => @ar_options[:include],
543
+ # :group => @ar_options[:group],
544
+ # :conditions => @options[:conditions]
545
+ # )
546
+ # end
547
+ # end
552
548
 
553
549
 
554
550
  def resultset_without_paging_with_user_filters #:nodoc:
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "wice_grid"
8
- s.version = "3.2.1.pre2"
8
+ s.version = "3.2.1.pre3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yuri Leikind"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wice_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1.pre2
4
+ version: 3.2.1.pre3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: