kaminari 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kaminari might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.10.3
2
+
3
+ * Fixed a bug that total_count() didn't work when chained with group() scope
4
+ #21 [jgeiger]
5
+
6
+ * Fixed a bug that the paginate helper didn't work properly with an Ajax call
7
+ #23 [hjuskewycz]
8
+
1
9
  == 0.10.2
2
10
 
3
11
  * Added :param_name option to the pagination helper #10 [ivanvr]
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
18
18
  gem.homepage = "http://github.com/amatsuda/kaminari"
19
19
  gem.license = "MIT"
20
20
  gem.summary = 'A pagination engine plugin for Rails 3'
21
- gem.description = 'Kaminari is a Scope & Engine based clean and powerful and customizable and sophisticated paginator for Rails 3'
21
+ gem.description = 'Kaminari is a Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3'
22
22
  gem.email = "ronnie@dio.jp"
23
23
  gem.authors = ["Akira Matsuda"]
24
24
  # Include your dependencies below. Runtime dependencies are required when using your gem,
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.2
1
+ 0.10.3
@@ -7,7 +7,7 @@
7
7
  paginator: the paginator that renders the pagination tags inside
8
8
  -%>
9
9
  <%= paginator.render do -%>
10
- <nav class='pagination'>
10
+ <nav class="pagination">
11
11
  <%= current_page > 1 ? prev_link_tag : prev_span_tag %>
12
12
  <% each_page do |page| -%>
13
13
  <% if page.current? -%>
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kaminari}
8
- s.version = "0.10.2"
8
+ s.version = "0.10.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Akira Matsuda"]
12
- s.date = %q{2011-02-22}
13
- s.description = %q{Kaminari is a Scope & Engine based clean and powerful and customizable and sophisticated paginator for Rails 3}
12
+ s.date = %q{2011-02-23}
13
+ s.description = %q{Kaminari is a Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3}
14
14
  s.email = %q{ronnie@dio.jp}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
@@ -17,10 +17,6 @@ module Kaminari
17
17
  resolver.find_all(*args_for_lookup(name)).present?
18
18
  end
19
19
 
20
- def output_buffer #:nodoc:
21
- @template.instance_variable_get('@output_buffer')
22
- end
23
-
24
20
  private
25
21
  def context
26
22
  @template.instance_variable_get('@lookup_context')
@@ -74,17 +74,13 @@ module Kaminari
74
74
  def initialize(template, window_options) #:nodoc:
75
75
  @template, @options = template, window_options.reverse_merge(template.options)
76
76
  # so that this instance can actually "render". Black magic?
77
- @output_buffer = @template.output_buffer
78
- if @output_buffer.nil?
79
- @output_buffer, @return_buffer = ActionView::OutputBuffer.new, true
80
- end
77
+ @output_buffer = ActionView::OutputBuffer.new
81
78
  end
82
79
 
83
80
  # render given block as a view template
84
81
  def render(&block)
85
82
  instance_eval &block if @options[:num_pages] > 1
86
- # return the output text only if the output_buffer was created inside this instance
87
- @return_buffer ? @output_buffer : nil
83
+ @output_buffer
88
84
  end
89
85
 
90
86
  # enumerate each page providing PageProxy object as the block parameter
@@ -3,7 +3,9 @@ module Kaminari
3
3
  extend ActiveSupport::Concern
4
4
  module InstanceMethods
5
5
  def total_count #:nodoc:
6
- except(:offset, :limit).count
6
+ c = except(:offset, :limit).count
7
+ # .group returns an OrderdHash that responds to #count
8
+ c.respond_to?(:count) ? c.count : c
7
9
  end
8
10
  end
9
11
  end
@@ -42,7 +42,7 @@ Object.const_set(:ApplicationHelper, Module.new)
42
42
  #migrations
43
43
  class CreateAllTables < ActiveRecord::Migration
44
44
  def self.up
45
- create_table(:users) {|t| t.string :name }
46
- create_table(:books) {|t| t.string :title }
45
+ create_table(:users) {|t| t.string :name; t.integer :age}
46
+ create_table(:books) {|t| t.string :title}
47
47
  end
48
48
  end
@@ -3,7 +3,7 @@ require File.expand_path('../spec_helper', File.dirname(__FILE__))
3
3
  describe Kaminari::ActiveRecordExtension do
4
4
  before :all do
5
5
  User.delete_all
6
- 1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}" }
6
+ 1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
7
7
  end
8
8
 
9
9
  describe '#page' do
@@ -94,4 +94,11 @@ describe Kaminari::ActiveRecordExtension do
94
94
  its(:current_page) { should == 2 }
95
95
  end
96
96
  end
97
+
98
+ context 'chained with .group' do
99
+ subject { User.group('age').page(2).per 5 }
100
+ # 0..10
101
+ its(:total_count) { should == 11 }
102
+ its(:num_pages) { should == 3 }
103
+ end
97
104
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 2
10
- version: 0.10.2
9
+ - 3
10
+ version: 0.10.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akira Matsuda
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-22 00:00:00 +09:00
18
+ date: 2011-02-23 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -252,7 +252,7 @@ dependencies:
252
252
  prerelease: false
253
253
  type: :runtime
254
254
  requirement: *id015
255
- description: Kaminari is a Scope & Engine based clean and powerful and customizable and sophisticated paginator for Rails 3
255
+ description: Kaminari is a Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3
256
256
  email: ronnie@dio.jp
257
257
  executables: []
258
258