kaminari 0.16.3 → 0.17.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +26 -25
- data/CHANGELOG.rdoc +27 -0
- data/README.rdoc +1 -1
- data/Rakefile +21 -2
- data/gemfiles/active_record_30.gemfile +1 -3
- data/gemfiles/active_record_31.gemfile +1 -8
- data/gemfiles/active_record_32.gemfile +1 -9
- data/gemfiles/active_record_40.gemfile +1 -0
- data/gemfiles/active_record_41.gemfile +1 -0
- data/gemfiles/active_record_42.gemfile +1 -0
- data/gemfiles/data_mapper_12.gemfile +1 -8
- data/gemfiles/mongo_mapper.gemfile +5 -11
- data/gemfiles/mongoid_30.gemfile +1 -0
- data/gemfiles/mongoid_31.gemfile +1 -0
- data/gemfiles/mongoid_40.gemfile +1 -0
- data/gemfiles/mongoid_50.gemfile +23 -0
- data/gemfiles/sinatra_13.gemfile +1 -8
- data/gemfiles/sinatra_14.gemfile +5 -15
- data/kaminari.gemspec +10 -10
- data/lib/kaminari/helpers/action_view_extension.rb +1 -1
- data/lib/kaminari/helpers/paginator.rb +1 -1
- data/lib/kaminari/helpers/tags.rb +4 -1
- data/lib/kaminari/hooks.rb +31 -14
- data/lib/kaminari/models/mongoid_extension.rb +1 -1
- data/lib/kaminari/models/page_scope_methods.rb +5 -2
- data/lib/kaminari/railtie.rb +1 -1
- data/lib/kaminari/sinatra.rb +2 -0
- data/lib/kaminari/version.rb +1 -1
- data/spec/fake_app/mongoid/config.rb +3 -1
- data/spec/helpers/action_view_extension_spec.rb +12 -0
- metadata +4 -4
- data/gemfiles/mongoid_24.gemfile +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f6f180b0164209c6b789f3ae855089840a905fd
|
4
|
+
data.tar.gz: 2bbc06afb48a4e28ca76f7c960b359eb440f4dc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3e4ac52fe8981e2610495da987398d455e25984d27a558f98175b512f22a938c58798225be16d526f38c6d19f9a1e1274612d6cf9e68e11f06bd4f4b8b0838a
|
7
|
+
data.tar.gz: 4f162bbb0935a179d6586316e9d3cf476ce1db7d15a61698c83313edf8c367b0df9ac14b99148e2153102f807f54d55fc1fe29894168417371b1954bf035ad63
|
data/.travis.yml
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 1.8.7
|
5
4
|
- 1.9.3
|
6
5
|
- 2.0.0
|
7
|
-
- 2.1
|
8
|
-
- 2.2
|
9
|
-
-
|
6
|
+
- 2.1.10
|
7
|
+
- 2.2.5
|
8
|
+
- 2.3.1
|
9
|
+
- jruby-1.7.25
|
10
|
+
- jruby-9.1.0.0
|
10
11
|
- rbx-2
|
11
12
|
|
12
13
|
gemfile:
|
@@ -16,12 +17,13 @@ gemfile:
|
|
16
17
|
- gemfiles/active_record_40.gemfile
|
17
18
|
- gemfiles/active_record_41.gemfile
|
18
19
|
- gemfiles/active_record_42.gemfile
|
20
|
+
- gemfiles/active_record_edge.gemfile
|
19
21
|
- gemfiles/data_mapper_12.gemfile
|
20
22
|
- gemfiles/mongo_mapper.gemfile
|
21
|
-
- gemfiles/mongoid_24.gemfile
|
22
23
|
- gemfiles/mongoid_30.gemfile
|
23
24
|
- gemfiles/mongoid_31.gemfile
|
24
25
|
- gemfiles/mongoid_40.gemfile
|
26
|
+
- gemfiles/mongoid_50.gemfile
|
25
27
|
- gemfiles/sinatra_13.gemfile
|
26
28
|
- gemfiles/sinatra_14.gemfile
|
27
29
|
|
@@ -35,29 +37,28 @@ cache: bundler
|
|
35
37
|
|
36
38
|
matrix:
|
37
39
|
exclude:
|
38
|
-
- rvm: 1.
|
39
|
-
gemfile: gemfiles/
|
40
|
-
- rvm:
|
41
|
-
gemfile: gemfiles/
|
42
|
-
- rvm: 1.
|
43
|
-
gemfile: gemfiles/
|
44
|
-
- rvm:
|
45
|
-
gemfile: gemfiles/mongoid_30.gemfile
|
46
|
-
- rvm: 1.8.7
|
47
|
-
gemfile: gemfiles/mongoid_31.gemfile
|
48
|
-
- rvm: 1.8.7
|
49
|
-
gemfile: gemfiles/mongoid_40.gemfile
|
50
|
-
- rvm: 2.2
|
40
|
+
- rvm: 1.9.3
|
41
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
42
|
+
- rvm: 2.0.0
|
43
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
44
|
+
- rvm: 2.1.10
|
45
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
46
|
+
- rvm: 2.2.5
|
51
47
|
gemfile: gemfiles/active_record_30.gemfile
|
52
|
-
- rvm: 2.2
|
48
|
+
- rvm: 2.2.5
|
53
49
|
gemfile: gemfiles/active_record_31.gemfile
|
54
|
-
- rvm: 2.2
|
50
|
+
- rvm: 2.2.5
|
55
51
|
gemfile: gemfiles/active_record_32.gemfile
|
56
|
-
- rvm: 2.
|
57
|
-
gemfile: gemfiles/
|
52
|
+
- rvm: 2.3.1
|
53
|
+
gemfile: gemfiles/active_record_30.gemfile
|
54
|
+
- rvm: 2.3.1
|
55
|
+
gemfile: gemfiles/active_record_31.gemfile
|
56
|
+
- rvm: 2.3.1
|
57
|
+
gemfile: gemfiles/active_record_32.gemfile
|
58
|
+
- rvm: jruby-1.7.25
|
59
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
58
60
|
allow_failures:
|
59
|
-
- rvm: 1.
|
60
|
-
|
61
|
-
- rvm: jruby
|
61
|
+
- rvm: jruby-1.7.25
|
62
|
+
- rvm: jruby-9.1.0.0
|
62
63
|
- rvm: rbx-2
|
63
64
|
fast_finish: true
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
== 0.17.0
|
2
|
+
|
3
|
+
* Rails 5 ready!
|
4
|
+
|
5
|
+
* Mongoid 5.0 support
|
6
|
+
|
7
|
+
* Dropped Ruby 1.8 support
|
8
|
+
|
9
|
+
* Dropped Mongoid 2.x support
|
10
|
+
|
11
|
+
* Extracted Sinatra support to kaminari-sinatra gem
|
12
|
+
|
13
|
+
* Extracted DataMapper support to kaminari-data_mapper gem
|
14
|
+
|
15
|
+
* Extracted Mongoid support to kaminari-mongoid gem
|
16
|
+
|
17
|
+
* Extracted MongoMapper support to kaminari-mongo_mapper gem
|
18
|
+
|
19
|
+
* Deprecated Kaminari::PageScopeMethods#num_pages in favor of `total_pages`
|
20
|
+
|
21
|
+
* Deprecated :num_pages option for `paginate` in favor of :total_pages
|
22
|
+
|
23
|
+
* Fixed mangled params in pagination links on Rails 5 #766 [audionerd]
|
24
|
+
|
25
|
+
* Fixed a bug where the range of the records displayed on the last page
|
26
|
+
doesn't match #718 [danzanzini]
|
27
|
+
|
1
28
|
== 0.16.3
|
2
29
|
|
3
30
|
* Fixed a "stack level too deep" bug in mongoid #642 [bartes]
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -13,7 +13,26 @@ end
|
|
13
13
|
task :default => "spec:all"
|
14
14
|
|
15
15
|
namespace :spec do
|
16
|
-
%w(
|
16
|
+
mappers = %w(
|
17
|
+
active_record_edge
|
18
|
+
active_record_42
|
19
|
+
active_record_41
|
20
|
+
active_record_40
|
21
|
+
active_record_32
|
22
|
+
active_record_31
|
23
|
+
active_record_30
|
24
|
+
data_mapper_12
|
25
|
+
mongoid_50
|
26
|
+
mongoid_40
|
27
|
+
mongoid_31
|
28
|
+
mongoid_30
|
29
|
+
mongoid_24
|
30
|
+
mongo_mapper
|
31
|
+
sinatra_13
|
32
|
+
sinatra_14
|
33
|
+
)
|
34
|
+
|
35
|
+
mappers.each do |gemfile|
|
17
36
|
desc "Run Tests against #{gemfile}"
|
18
37
|
task gemfile do
|
19
38
|
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
@@ -23,7 +42,7 @@ namespace :spec do
|
|
23
42
|
|
24
43
|
desc "Run Tests against all ORMs"
|
25
44
|
task :all do
|
26
|
-
|
45
|
+
mappers.each do |gemfile|
|
27
46
|
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
28
47
|
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
29
48
|
end
|
@@ -6,9 +6,7 @@ gem 'rspec-rails', '~> 2.14.1'
|
|
6
6
|
gem 'nokogiri', '< 1.6'
|
7
7
|
gem 'capybara', '< 2.1'
|
8
8
|
|
9
|
-
|
10
|
-
gem 'rubyzip', '< 1'
|
11
|
-
gem 'mime-types', '< 2'
|
9
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
12
10
|
|
13
11
|
platforms :ruby do
|
14
12
|
if RUBY_VERSION > "2.1.0"
|
@@ -4,11 +4,7 @@ gem 'railties', '~> 3.1.12'
|
|
4
4
|
gem 'activerecord', '~> 3.1.12', :require => 'active_record'
|
5
5
|
gem 'rspec-rails', '~> 2.14.1'
|
6
6
|
|
7
|
-
|
8
|
-
gem 'capybara', '< 2.1'
|
9
|
-
gem 'nokogiri', '< 1.6'
|
10
|
-
gem 'rubyzip', '< 1'
|
11
|
-
gem 'mime-types', '< 2'
|
7
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
12
8
|
|
13
9
|
platforms :ruby do
|
14
10
|
if RUBY_VERSION > "2.1.0"
|
@@ -16,9 +12,6 @@ platforms :ruby do
|
|
16
12
|
else
|
17
13
|
gem 'sqlite3', '1.3.8'
|
18
14
|
end
|
19
|
-
if RUBY_VERSION <= "1.8.7"
|
20
|
-
gem 'i18n', '< 0.7.0'
|
21
|
-
end
|
22
15
|
end
|
23
16
|
platforms :jruby do
|
24
17
|
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
@@ -3,12 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'railties', '~> 3.2.3'
|
4
4
|
gem 'activerecord', '~> 3.2.3', :require => 'active_record'
|
5
5
|
gem 'rspec-rails', '~> 2.14.1'
|
6
|
-
|
7
|
-
# Stick To Versions That Work Under Ruby 1.8 For Now
|
8
|
-
gem 'capybara', '< 2.1'
|
9
|
-
gem 'nokogiri', '< 1.6'
|
10
|
-
gem 'rubyzip', '< 1'
|
11
|
-
gem 'mime-types', '< 2'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
12
7
|
|
13
8
|
platforms :ruby do
|
14
9
|
if RUBY_VERSION > "2.1.0"
|
@@ -16,9 +11,6 @@ platforms :ruby do
|
|
16
11
|
else
|
17
12
|
gem 'sqlite3', '1.3.8'
|
18
13
|
end
|
19
|
-
if RUBY_VERSION <= "1.8.7"
|
20
|
-
gem 'i18n', '< 0.7.0'
|
21
|
-
end
|
22
14
|
end
|
23
15
|
platforms :jruby do
|
24
16
|
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
@@ -9,11 +9,7 @@ gem 'dm-active_model', '~> 1.2.1'
|
|
9
9
|
gem 'dm-sqlite-adapter', '~> 1.2.0'
|
10
10
|
gem 'rspec-rails', '~> 2.14.1'
|
11
11
|
|
12
|
-
|
13
|
-
gem 'capybara', '< 2.1'
|
14
|
-
gem 'nokogiri', '< 1.6'
|
15
|
-
gem 'rubyzip', '< 1'
|
16
|
-
gem 'mime-types', '< 2'
|
12
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
17
13
|
|
18
14
|
platforms :ruby do
|
19
15
|
if RUBY_VERSION > "2.1.0"
|
@@ -22,9 +18,6 @@ platforms :ruby do
|
|
22
18
|
else
|
23
19
|
gem 'sqlite3', '1.3.8'
|
24
20
|
end
|
25
|
-
if RUBY_VERSION <= "1.8.7"
|
26
|
-
gem 'i18n', '< 0.7.0'
|
27
|
-
end
|
28
21
|
end
|
29
22
|
platforms :jruby do
|
30
23
|
gem 'activerecord-jdbcsqlite3-adapter', '~> 1.2.0'
|
@@ -5,19 +5,13 @@ gem 'bson', '~> 1.9.2'
|
|
5
5
|
gem 'mongo_mapper', '>= 0.11.0'
|
6
6
|
gem 'rspec-rails', '~> 2.14.1'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gem 'nokogiri', '< 1.6'
|
12
|
-
gem 'rubyzip', '< 1'
|
13
|
-
gem 'mime-types', '< 2'
|
8
|
+
gem 'capybara'
|
9
|
+
gem 'nokogiri'
|
10
|
+
gem 'rubyzip'
|
14
11
|
|
15
|
-
|
16
|
-
gem '
|
12
|
+
if RUBY_VERSION == '1.9.3'
|
13
|
+
gem 'mime-types', '2.99'
|
17
14
|
else
|
18
|
-
gem 'capybara'
|
19
|
-
gem 'nokogiri'
|
20
|
-
gem 'rubyzip'
|
21
15
|
gem 'mime-types'
|
22
16
|
end
|
23
17
|
|
data/gemfiles/mongoid_30.gemfile
CHANGED
data/gemfiles/mongoid_31.gemfile
CHANGED
data/gemfiles/mongoid_40.gemfile
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 4.0'
|
4
|
+
gem 'mongoid', '~> 5.0.0'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
7
|
+
|
8
|
+
group :development, :test do
|
9
|
+
gem 'database_cleaner', '~> 1.5.1'
|
10
|
+
end
|
11
|
+
|
12
|
+
platforms :mri do
|
13
|
+
gem 'test-unit' if RUBY_VERSION > '2.1.0'
|
14
|
+
end
|
15
|
+
|
16
|
+
platforms :rbx do
|
17
|
+
gem 'rubysl', '~> 2.0'
|
18
|
+
gem 'racc'
|
19
|
+
gem 'minitest'
|
20
|
+
gem 'rubinius-developer_tools'
|
21
|
+
end
|
22
|
+
|
23
|
+
gemspec :path => '../'
|
data/gemfiles/sinatra_13.gemfile
CHANGED
@@ -14,6 +14,7 @@ end
|
|
14
14
|
gem 'rack-test'
|
15
15
|
gem 'sinatra-contrib'
|
16
16
|
gem 'rspec', '~> 2.14.1'
|
17
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
17
18
|
|
18
19
|
platforms :ruby do
|
19
20
|
if RUBY_VERSION > "2.1.0"
|
@@ -21,14 +22,6 @@ platforms :ruby do
|
|
21
22
|
else
|
22
23
|
gem 'sqlite3', '1.3.8'
|
23
24
|
end
|
24
|
-
if RUBY_VERSION <= "1.8.7"
|
25
|
-
# stick to versions that work under Ruby 1.8 for now
|
26
|
-
gem 'mime-types', '< 2.0'
|
27
|
-
gem 'nokogiri', '< 1.6'
|
28
|
-
gem 'capybara', '< 2.1'
|
29
|
-
gem 'rubyzip', '< 1'
|
30
|
-
gem 'i18n', '< 0.7.0'
|
31
|
-
end
|
32
25
|
end
|
33
26
|
platforms :jruby do
|
34
27
|
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
data/gemfiles/sinatra_14.gemfile
CHANGED
@@ -3,22 +3,15 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'sinatra', '~> 1.4.0'
|
4
4
|
gem 'rspec', '~> 2.14.1'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
gem 'padrino-helpers', '~> 0.11.0'
|
9
|
-
else
|
10
|
-
gem 'activerecord', '>= 4.0.0', :require => 'active_record'
|
11
|
-
gem 'padrino-helpers', '~> 0.12.0'
|
12
|
-
end
|
6
|
+
gem 'activerecord', '>= 4.0.0', :require => 'active_record'
|
7
|
+
gem 'padrino-helpers', '~> 0.12.0'
|
13
8
|
|
14
9
|
gem 'rack-test', '>= 0'
|
15
10
|
gem 'sinatra-contrib', '~> 1.4.0'
|
16
11
|
|
17
|
-
|
18
|
-
gem 'mime-types', '
|
19
|
-
|
20
|
-
gem 'capybara', '< 2.1'
|
21
|
-
gem 'rubyzip', '< 1'
|
12
|
+
if RUBY_VERSION == '1.9.3'
|
13
|
+
gem 'mime-types', '2.99'
|
14
|
+
end
|
22
15
|
|
23
16
|
platforms :ruby do
|
24
17
|
if RUBY_VERSION > "2.1.0"
|
@@ -26,9 +19,6 @@ platforms :ruby do
|
|
26
19
|
else
|
27
20
|
gem 'sqlite3', '1.3.8'
|
28
21
|
end
|
29
|
-
if RUBY_VERSION <= "1.8.7"
|
30
|
-
gem 'i18n', '< 0.7.0'
|
31
|
-
end
|
32
22
|
end
|
33
23
|
platforms :jruby do
|
34
24
|
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
data/kaminari.gemspec
CHANGED
@@ -21,15 +21,15 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.licenses = ['MIT']
|
23
23
|
|
24
|
-
s.add_dependency 'activesupport',
|
25
|
-
s.add_dependency 'actionpack',
|
24
|
+
s.add_dependency 'activesupport', '>= 3.0.0'
|
25
|
+
s.add_dependency 'actionpack', '>= 3.0.0'
|
26
26
|
|
27
|
-
s.add_development_dependency 'bundler',
|
28
|
-
s.add_development_dependency 'rake',
|
29
|
-
s.add_development_dependency 'tzinfo',
|
30
|
-
s.add_development_dependency 'rspec',
|
31
|
-
s.add_development_dependency 'rr',
|
32
|
-
s.add_development_dependency 'capybara',
|
33
|
-
s.add_development_dependency 'database_cleaner',
|
34
|
-
s.add_development_dependency 'rdoc',
|
27
|
+
s.add_development_dependency 'bundler', '>= 1.0.0'
|
28
|
+
s.add_development_dependency 'rake', '>= 0'
|
29
|
+
s.add_development_dependency 'tzinfo', '>= 0'
|
30
|
+
s.add_development_dependency 'rspec', '>= 0'
|
31
|
+
s.add_development_dependency 'rr', (RUBY_VERSION < '2' ? '< 1.2' : '>= 0')
|
32
|
+
s.add_development_dependency 'capybara', '>= 1.0'
|
33
|
+
s.add_development_dependency 'database_cleaner', '~> 1.2.0'
|
34
|
+
s.add_development_dependency 'rdoc', '>= 0'
|
35
35
|
end
|
@@ -95,7 +95,7 @@ module Kaminari
|
|
95
95
|
t('helpers.page_entries_info.one_page.display_entries', :entry_name => entry_name, :count => collection.total_count)
|
96
96
|
else
|
97
97
|
first = collection.offset_value + 1
|
98
|
-
last = collection.
|
98
|
+
last = (sum = collection.offset_value + collection.limit_value) > collection.total_count ? collection.total_count : sum
|
99
99
|
t('helpers.page_entries_info.more_pages.display_entries', :entry_name => entry_name, :first => first, :last => last, :total => collection.total_count)
|
100
100
|
end.html_safe
|
101
101
|
end
|
@@ -12,7 +12,7 @@ module Kaminari
|
|
12
12
|
include ::ActionView::Context
|
13
13
|
|
14
14
|
def initialize(template, options) #:nodoc:
|
15
|
-
|
15
|
+
ActiveSupport::Deprecation.warn 'num_pages is deprecated and will be removed in Kaminari 1.0. Please use total_pages instead.' if options.has_key? :num_pages
|
16
16
|
options[:num_pages] ||= options[:total_pages]
|
17
17
|
|
18
18
|
@window_options = {}.tap do |h|
|
@@ -18,7 +18,10 @@ module Kaminari
|
|
18
18
|
@param_name = @options.delete(:param_name) || Kaminari.config.param_name
|
19
19
|
@theme = @options.delete(:theme)
|
20
20
|
@views_prefix = @options.delete(:views_prefix)
|
21
|
-
@params =
|
21
|
+
@params = template.params
|
22
|
+
# @params in Rails 5 no longer inherits from Hash
|
23
|
+
@params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
|
24
|
+
@params = @params.except(:script_name).merge(@options.delete(:params) || {})
|
22
25
|
end
|
23
26
|
|
24
27
|
def to_s(locals = {}) #:nodoc:
|
data/lib/kaminari/hooks.rb
CHANGED
@@ -6,25 +6,42 @@ module Kaminari
|
|
6
6
|
::ActiveRecord::Base.send :include, Kaminari::ActiveRecordExtension
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
require '
|
12
|
-
|
13
|
-
|
14
|
-
::DataMapper
|
15
|
-
|
9
|
+
# data_mapper
|
10
|
+
begin
|
11
|
+
require 'kaminari/data_mapper'
|
12
|
+
rescue LoadError
|
13
|
+
begin; require 'data_mapper'; rescue LoadError; end
|
14
|
+
if defined? ::DataMapper
|
15
|
+
require 'dm-aggregates'
|
16
|
+
require 'kaminari/models/data_mapper_extension'
|
17
|
+
::DataMapper::Collection.send :include, Kaminari::DataMapperExtension::Collection
|
18
|
+
::DataMapper::Model.append_extensions Kaminari::DataMapperExtension::Model
|
19
|
+
# ::DataMapper::Model.send :extend, Kaminari::DataMapperExtension::Model
|
20
|
+
end
|
16
21
|
end
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
require 'kaminari/
|
21
|
-
|
23
|
+
## mongoid
|
24
|
+
begin
|
25
|
+
require 'kaminari/mongoid'
|
26
|
+
rescue LoadError
|
27
|
+
begin; require 'mongoid'; rescue LoadError; end
|
28
|
+
if defined? ::Mongoid
|
29
|
+
ActiveSupport::Deprecation.warn 'Kaminari Mongoid support has been extracted to a separate gem, and will be removed in the next 1.0 release. Please bundle kaminari-mongoid gem.'
|
30
|
+
require 'kaminari/models/mongoid_extension'
|
31
|
+
::Mongoid::Document.send :include, Kaminari::MongoidExtension::Document
|
32
|
+
end
|
22
33
|
end
|
23
34
|
|
35
|
+
## mongo_mapper
|
24
36
|
ActiveSupport.on_load(:mongo_mapper) do
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
begin
|
38
|
+
require 'kaminari/mongo_mapper'
|
39
|
+
rescue LoadError
|
40
|
+
ActiveSupport::Deprecation.warn 'Kaminari MongoMapper support has been extracted to a separate gem, and will be removed in the next 1.0 release. Please bundle kaminari-mongo_mapper gem.'
|
41
|
+
require 'kaminari/models/mongo_mapper_extension'
|
42
|
+
::MongoMapper::Document.send :include, Kaminari::MongoMapperExtension::Document
|
43
|
+
::Plucky::Query.send :include, Kaminari::PluckyCriteriaMethods
|
44
|
+
end
|
28
45
|
end
|
29
46
|
require 'kaminari/models/array_extension'
|
30
47
|
|
@@ -30,8 +30,11 @@ module Kaminari
|
|
30
30
|
total_pages_count
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
|
-
|
33
|
+
|
34
|
+
def num_pages
|
35
|
+
ActiveSupport::Deprecation.warn 'num_pages is deprecated and will be removed in Kaminari 1.0. Please use total_pages instead.'
|
36
|
+
total_pages
|
37
|
+
end
|
35
38
|
|
36
39
|
# Current page number
|
37
40
|
def current_page
|
data/lib/kaminari/railtie.rb
CHANGED
data/lib/kaminari/sinatra.rb
CHANGED
@@ -2,4 +2,6 @@ require 'sinatra/base'
|
|
2
2
|
require 'kaminari'
|
3
3
|
require 'kaminari/helpers/sinatra_helpers'
|
4
4
|
|
5
|
+
ActiveSupport::Deprecation.warn 'Kaminari Sinatra support has been extracted to a separate gem, and will be removed in the next 1.0 release. Please bundle kaminari-sinatra gem.'
|
6
|
+
|
5
7
|
Kaminari::Hooks.init
|
data/lib/kaminari/version.rb
CHANGED
@@ -10,7 +10,9 @@ if RUBY_VERSION >= '1.9.2' && RUBY_VERSION < '2.2.0'
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Mongoid.configure do |config|
|
13
|
-
if Mongoid::VERSION
|
13
|
+
if Mongoid::VERSION >= '5.0.0'
|
14
|
+
config.connect_to 'kaminari_test'
|
15
|
+
elsif Mongoid::VERSION > '3.0.0'
|
14
16
|
config.sessions = {:default => {:hosts => ['0.0.0.0:27017'], :database => 'kaminari_test'}}
|
15
17
|
else
|
16
18
|
config.master = Mongo::Connection.new.db('kaminari_test')
|
@@ -177,6 +177,18 @@ describe 'Kaminari::ActionViewExtension', :if => defined?(Rails)do
|
|
177
177
|
it { should == 'Displaying members <b>26 - 50</b> of <b>50</b> in total' }
|
178
178
|
end
|
179
179
|
end
|
180
|
+
|
181
|
+
describe 'the last page' do
|
182
|
+
before do
|
183
|
+
User.max_pages_per 4
|
184
|
+
@users = User.page(4).per(10)
|
185
|
+
end
|
186
|
+
|
187
|
+
after { User.max_pages_per nil }
|
188
|
+
|
189
|
+
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
|
190
|
+
it { should == 'Displaying users <b>31 - 40</b> of <b>50</b> in total' }
|
191
|
+
end
|
180
192
|
end
|
181
193
|
end
|
182
194
|
context 'on a model with namespace' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaminari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -203,10 +203,10 @@ files:
|
|
203
203
|
- gemfiles/active_record_edge.gemfile
|
204
204
|
- gemfiles/data_mapper_12.gemfile
|
205
205
|
- gemfiles/mongo_mapper.gemfile
|
206
|
-
- gemfiles/mongoid_24.gemfile
|
207
206
|
- gemfiles/mongoid_30.gemfile
|
208
207
|
- gemfiles/mongoid_31.gemfile
|
209
208
|
- gemfiles/mongoid_40.gemfile
|
209
|
+
- gemfiles/mongoid_50.gemfile
|
210
210
|
- gemfiles/sinatra_13.gemfile
|
211
211
|
- gemfiles/sinatra_14.gemfile
|
212
212
|
- kaminari.gemspec
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
version: '0'
|
292
292
|
requirements: []
|
293
293
|
rubyforge_project: kaminari
|
294
|
-
rubygems_version: 2.4
|
294
|
+
rubygems_version: 2.6.4
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: A pagination engine plugin for Rails 3+ and other modern frameworks
|
data/gemfiles/mongoid_24.gemfile
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'railties', '>= 3.2.3'
|
4
|
-
gem 'mongoid', '~> 2.4.0'
|
5
|
-
gem 'rspec-rails', '~> 2.14.1'
|
6
|
-
|
7
|
-
# stick to versions that work under Ruby 1.8 for now
|
8
|
-
gem 'capybara', '< 2.1'
|
9
|
-
gem 'nokogiri', '< 1.6'
|
10
|
-
gem 'rubyzip', '< 1'
|
11
|
-
gem 'mime-types', '< 2'
|
12
|
-
gem 'database_cleaner', '< 1.0.0'
|
13
|
-
|
14
|
-
if RUBY_VERSION <= "1.8.7"
|
15
|
-
gem 'i18n', '< 0.7.0'
|
16
|
-
end
|
17
|
-
|
18
|
-
platforms :rbx do
|
19
|
-
gem 'rubysl', '~> 2.0'
|
20
|
-
gem 'racc'
|
21
|
-
gem 'minitest'
|
22
|
-
gem 'rubinius-developer_tools'
|
23
|
-
end
|
24
|
-
|
25
|
-
gemspec :path => '../'
|