kaminari 0.14.1 → 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 +7 -0
- data/.document +1 -4
- data/.gitignore +1 -0
- data/.travis.yml +52 -5
- data/{CHANGELOG → CHANGELOG.rdoc} +129 -0
- data/Gemfile +1 -1
- data/README.rdoc +66 -25
- data/Rakefile +32 -9
- data/app/views/kaminari/_first_page.html.erb +1 -1
- data/app/views/kaminari/_first_page.html.haml +1 -1
- data/app/views/kaminari/_first_page.html.slim +1 -1
- data/app/views/kaminari/_gap.html.erb +1 -1
- data/app/views/kaminari/_gap.html.haml +1 -1
- data/app/views/kaminari/_gap.html.slim +1 -1
- data/app/views/kaminari/_last_page.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.haml +1 -1
- data/app/views/kaminari/_last_page.html.slim +1 -1
- data/app/views/kaminari/_next_page.html.erb +1 -1
- data/app/views/kaminari/_next_page.html.haml +1 -1
- data/app/views/kaminari/_next_page.html.slim +1 -1
- data/app/views/kaminari/_prev_page.html.erb +1 -1
- data/app/views/kaminari/_prev_page.html.haml +1 -1
- data/app/views/kaminari/_prev_page.html.slim +1 -1
- data/gemfiles/active_record_30.gemfile +25 -4
- data/gemfiles/active_record_31.gemfile +23 -4
- data/gemfiles/active_record_32.gemfile +22 -4
- data/gemfiles/active_record_40.gemfile +26 -0
- data/gemfiles/active_record_41.gemfile +25 -0
- data/gemfiles/active_record_42.gemfile +25 -0
- data/gemfiles/active_record_edge.gemfile +30 -0
- data/gemfiles/data_mapper_12.gemfile +30 -10
- data/gemfiles/mongo_mapper.gemfile +20 -2
- data/gemfiles/mongoid_30.gemfile +18 -3
- data/gemfiles/mongoid_31.gemfile +21 -0
- data/gemfiles/mongoid_40.gemfile +19 -0
- data/gemfiles/mongoid_50.gemfile +23 -0
- data/gemfiles/sinatra_13.gemfile +36 -0
- data/gemfiles/sinatra_14.gemfile +33 -0
- data/kaminari.gemspec +13 -14
- data/lib/generators/kaminari/views_generator.rb +9 -8
- data/lib/kaminari/config.rb +2 -0
- data/lib/kaminari/helpers/action_view_extension.rb +9 -28
- data/lib/kaminari/helpers/paginator.rb +38 -18
- data/lib/kaminari/helpers/sinatra_helpers.rb +41 -3
- data/lib/kaminari/helpers/tags.rb +18 -5
- data/lib/kaminari/hooks.rb +31 -15
- data/lib/kaminari/models/active_record_extension.rb +8 -8
- data/lib/kaminari/models/active_record_model_extension.rb +8 -6
- data/lib/kaminari/models/active_record_relation_methods.rb +21 -10
- data/lib/kaminari/models/array_extension.rb +17 -11
- data/lib/kaminari/models/configuration_methods.rb +16 -2
- data/lib/kaminari/models/data_mapper_collection_methods.rb +4 -0
- data/lib/kaminari/models/data_mapper_extension.rb +5 -2
- data/lib/kaminari/models/mongoid_criteria_methods.rb +18 -1
- data/lib/kaminari/models/mongoid_extension.rb +8 -15
- data/lib/kaminari/models/page_scope_methods.rb +37 -5
- data/lib/kaminari/models/plucky_criteria_methods.rb +6 -1
- data/lib/kaminari/railtie.rb +1 -1
- data/lib/kaminari/sinatra.rb +2 -0
- data/lib/kaminari/version.rb +1 -1
- data/lib/kaminari.rb +5 -4
- data/spec/config/config_spec.rb +15 -0
- data/spec/fake_app/active_record/config.rb +1 -1
- data/spec/fake_app/active_record/models.rb +9 -1
- data/spec/fake_app/mongo_mapper/config.rb +1 -1
- data/spec/fake_app/mongoid/config.rb +7 -3
- data/spec/fake_app/mongoid/models.rb +16 -0
- data/spec/fake_app/rails_app.rb +1 -0
- data/spec/fake_app/views/alternative/kaminari/_first_page.html.erb +1 -0
- data/spec/fake_app/views/alternative/kaminari/_paginator.html.erb +3 -0
- data/spec/fake_app/views/kaminari/bootstrap/_page.html.erb +1 -0
- data/spec/fake_app/views/kaminari/bootstrap/_paginator.html.erb +7 -0
- data/spec/fake_gem.rb +18 -2
- data/spec/generators/views_generator_spec.rb +18 -0
- data/spec/helpers/action_view_extension_spec.rb +68 -12
- data/spec/helpers/helpers_spec.rb +9 -0
- data/spec/helpers/sinatra_helpers_spec.rb +53 -0
- data/spec/models/active_record/active_record_relation_methods_spec.rb +48 -1
- data/spec/models/active_record/inherited_spec.rb +9 -0
- data/spec/models/active_record/scopes_spec.rb +104 -5
- data/spec/models/array_spec.rb +55 -4
- data/spec/models/configuration_methods_spec.rb +125 -0
- data/spec/models/data_mapper/data_mapper_spec.rb +76 -26
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +12 -0
- data/spec/models/mongoid/mongoid_spec.rb +119 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/spec_helper_for_sinatra.rb +2 -3
- data/spec/support/database_cleaner.rb +5 -2
- metadata +63 -87
- data/gemfiles/mongoid_24.gemfile +0 -7
- data/gemfiles/sinatra.gemfile +0 -10
- data/spec/models/active_record/default_per_page_spec.rb +0 -32
- data/spec/models/active_record/max_per_page_spec.rb +0 -32
@@ -1,7 +1,28 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'activerecord', '
|
5
|
-
gem 'rspec-rails', '
|
3
|
+
gem 'railties', '~> 3.0.20'
|
4
|
+
gem 'activerecord', '~> 3.0.20', :require => 'active_record'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'nokogiri', '< 1.6'
|
7
|
+
gem 'capybara', '< 2.1'
|
8
|
+
|
9
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
10
|
+
|
11
|
+
platforms :ruby do
|
12
|
+
if RUBY_VERSION > "2.1.0"
|
13
|
+
gem 'sqlite3'
|
14
|
+
else
|
15
|
+
gem 'sqlite3', '1.3.8'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
platforms :jruby do
|
19
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
20
|
+
end
|
21
|
+
platforms :rbx do
|
22
|
+
gem 'rubysl', '~> 2.0'
|
23
|
+
gem 'racc'
|
24
|
+
gem 'rubysl-test-unit'
|
25
|
+
gem 'rubinius-developer_tools'
|
26
|
+
end
|
6
27
|
|
7
28
|
gemspec :path => '../'
|
@@ -1,7 +1,26 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'activerecord', '
|
5
|
-
gem 'rspec-rails', '
|
3
|
+
gem 'railties', '~> 3.1.12'
|
4
|
+
gem 'activerecord', '~> 3.1.12', :require => 'active_record'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
|
7
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
8
|
+
|
9
|
+
platforms :ruby do
|
10
|
+
if RUBY_VERSION > "2.1.0"
|
11
|
+
gem 'sqlite3'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', '1.3.8'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
platforms :jruby do
|
17
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
18
|
+
end
|
19
|
+
platforms :rbx do
|
20
|
+
gem 'rubysl', '~> 2.0'
|
21
|
+
gem 'racc'
|
22
|
+
gem 'rubysl-test-unit'
|
23
|
+
gem 'rubinius-developer_tools'
|
24
|
+
end
|
6
25
|
|
7
26
|
gemspec :path => '../'
|
@@ -1,7 +1,25 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'activerecord', '
|
5
|
-
gem 'rspec-rails', '
|
3
|
+
gem 'railties', '~> 3.2.3'
|
4
|
+
gem 'activerecord', '~> 3.2.3', :require => 'active_record'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
7
|
+
|
8
|
+
platforms :ruby do
|
9
|
+
if RUBY_VERSION > "2.1.0"
|
10
|
+
gem 'sqlite3'
|
11
|
+
else
|
12
|
+
gem 'sqlite3', '1.3.8'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
platforms :jruby do
|
16
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
17
|
+
end
|
18
|
+
platforms :rbx do
|
19
|
+
gem 'rubysl', '~> 2.0'
|
20
|
+
gem 'racc'
|
21
|
+
gem 'rubysl-test-unit'
|
22
|
+
gem 'rubinius-developer_tools'
|
23
|
+
end
|
6
24
|
|
7
25
|
gemspec :path => '../'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 4.0.0'
|
4
|
+
gem 'activerecord', '~> 4.0.0', :require => 'active_record'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
7
|
+
|
8
|
+
platforms :ruby do
|
9
|
+
if RUBY_VERSION > "2.1.0"
|
10
|
+
gem 'sqlite3'
|
11
|
+
gem 'test-unit'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', '1.3.8'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
platforms :jruby do
|
17
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
18
|
+
end
|
19
|
+
platforms :rbx do
|
20
|
+
gem 'rubysl', '~> 2.0'
|
21
|
+
gem 'racc'
|
22
|
+
gem 'rubysl-test-unit'
|
23
|
+
gem 'rubinius-developer_tools'
|
24
|
+
end
|
25
|
+
|
26
|
+
gemspec :path => '../'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 4.1.0'
|
4
|
+
gem 'activerecord', '~> 4.1.0', :require => 'active_record'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
7
|
+
|
8
|
+
platforms :ruby do
|
9
|
+
if RUBY_VERSION > "2.1.0"
|
10
|
+
gem 'sqlite3'
|
11
|
+
else
|
12
|
+
gem 'sqlite3', '1.3.8'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
platforms :jruby do
|
16
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
17
|
+
end
|
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 => '../'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 4.2.0'
|
4
|
+
gem 'activerecord', '~> 4.2.0', :require => 'active_record'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
7
|
+
|
8
|
+
platforms :ruby do
|
9
|
+
if RUBY_VERSION > "2.1.0"
|
10
|
+
gem 'sqlite3'
|
11
|
+
else
|
12
|
+
gem 'sqlite3', '1.3.8'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
platforms :jruby do
|
16
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
17
|
+
end
|
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 => '../'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git 'git://github.com/rails/rails.git' do
|
4
|
+
gem 'railties'
|
5
|
+
gem 'activerecord', :require => 'active_record'
|
6
|
+
gem 'actionview', :require => 'action_view'
|
7
|
+
end
|
8
|
+
|
9
|
+
gem 'arel', :github => 'rails/arel'
|
10
|
+
|
11
|
+
platforms :ruby do
|
12
|
+
if RUBY_VERSION > "2.1.0"
|
13
|
+
gem 'sqlite3'
|
14
|
+
else
|
15
|
+
gem 'sqlite3', '1.3.8'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
platforms :jruby do
|
19
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
20
|
+
end
|
21
|
+
platforms :rbx do
|
22
|
+
gem 'rubysl', '~> 2.0'
|
23
|
+
gem 'racc'
|
24
|
+
gem 'minitest'
|
25
|
+
gem 'rubinius-developer_tools'
|
26
|
+
end
|
27
|
+
|
28
|
+
gem 'rspec-rails', '2.99.0'
|
29
|
+
|
30
|
+
gemspec :path => '../'
|
@@ -1,12 +1,32 @@
|
|
1
|
-
source
|
2
|
-
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'dm-core', '
|
5
|
-
gem 'dm-migrations', '
|
6
|
-
gem 'dm-aggregates', '
|
7
|
-
gem 'dm-transactions', '
|
8
|
-
gem 'dm-active_model', '
|
9
|
-
gem 'dm-sqlite-adapter', '
|
10
|
-
gem 'rspec-rails', '
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 3.2.21'
|
4
|
+
gem 'dm-core', '~> 1.2.0'
|
5
|
+
gem 'dm-migrations', '~> 1.2.0'
|
6
|
+
gem 'dm-aggregates', '~> 1.2.0'
|
7
|
+
gem 'dm-transactions', '~> 1.2.0'
|
8
|
+
gem 'dm-active_model', '~> 1.2.1'
|
9
|
+
gem 'dm-sqlite-adapter', '~> 1.2.0'
|
10
|
+
gem 'rspec-rails', '~> 2.14.1'
|
11
|
+
|
12
|
+
gem 'mime-types', '2.99' if RUBY_VERSION < '2.0.0'
|
13
|
+
|
14
|
+
platforms :ruby do
|
15
|
+
if RUBY_VERSION > "2.1.0"
|
16
|
+
gem 'sqlite3'
|
17
|
+
gem 'test-unit'
|
18
|
+
else
|
19
|
+
gem 'sqlite3', '1.3.8'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
platforms :jruby do
|
23
|
+
gem 'activerecord-jdbcsqlite3-adapter', '~> 1.2.0'
|
24
|
+
end
|
25
|
+
platforms :rbx do
|
26
|
+
gem 'rubysl', '~> 2.0'
|
27
|
+
gem 'racc'
|
28
|
+
gem 'rubysl-test-unit'
|
29
|
+
gem 'rubinius-developer_tools'
|
30
|
+
end
|
11
31
|
|
12
32
|
gemspec :path => '../'
|
@@ -1,7 +1,25 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'railties', '>= 3.2.3'
|
4
|
+
gem 'bson', '~> 1.9.2'
|
4
5
|
gem 'mongo_mapper', '>= 0.11.0'
|
5
|
-
gem 'rspec-rails', '
|
6
|
+
gem 'rspec-rails', '~> 2.14.1'
|
7
|
+
|
8
|
+
gem 'capybara'
|
9
|
+
gem 'nokogiri'
|
10
|
+
gem 'rubyzip'
|
11
|
+
|
12
|
+
if RUBY_VERSION == '1.9.3'
|
13
|
+
gem 'mime-types', '2.99'
|
14
|
+
else
|
15
|
+
gem 'mime-types'
|
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
|
6
24
|
|
7
25
|
gemspec :path => '../'
|
data/gemfiles/mongoid_30.gemfile
CHANGED
@@ -1,7 +1,22 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'railties', '>= 3.2.3'
|
4
|
-
gem 'mongoid', '
|
5
|
-
gem 'rspec-rails', '
|
4
|
+
gem 'mongoid', '~> 3.0.0'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'origin'
|
7
|
+
gem 'moped'
|
8
|
+
gem 'activesupport', '~> 3.2.18'
|
9
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
10
|
+
|
11
|
+
platforms :mri do
|
12
|
+
gem 'test-unit' if RUBY_VERSION > "2.1.0"
|
13
|
+
end
|
14
|
+
|
15
|
+
platforms :rbx do
|
16
|
+
gem 'rubysl', '~> 2.0'
|
17
|
+
gem 'racc'
|
18
|
+
gem 'rubysl-test-unit'
|
19
|
+
gem 'rubinius-developer_tools'
|
20
|
+
end
|
6
21
|
|
7
22
|
gemspec :path => '../'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 3.2'
|
4
|
+
gem 'mongoid', '~> 3.1.0'
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'origin'
|
7
|
+
gem 'moped'
|
8
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
9
|
+
|
10
|
+
platforms :mri do
|
11
|
+
gem 'test-unit' if RUBY_VERSION > "2.1.0"
|
12
|
+
end
|
13
|
+
|
14
|
+
platforms :rbx do
|
15
|
+
gem 'rubysl', '~> 2.0'
|
16
|
+
gem 'racc'
|
17
|
+
gem 'rubysl-test-unit'
|
18
|
+
gem 'rubinius-developer_tools'
|
19
|
+
end
|
20
|
+
|
21
|
+
gemspec :path => '../'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 4.0'
|
4
|
+
gem "mongoid", "~> 4.0.0.beta2"
|
5
|
+
gem 'rspec-rails', '~> 2.14.1'
|
6
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
7
|
+
|
8
|
+
platforms :mri do
|
9
|
+
gem 'test-unit' if RUBY_VERSION > "2.1.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
platforms :rbx do
|
13
|
+
gem 'rubysl', '~> 2.0'
|
14
|
+
gem 'racc'
|
15
|
+
gem 'minitest'
|
16
|
+
gem 'rubinius-developer_tools'
|
17
|
+
end
|
18
|
+
|
19
|
+
gemspec :path => '../'
|
@@ -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 => '../'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'sinatra', '~> 1.3.0'
|
4
|
+
gem 'tilt'
|
5
|
+
|
6
|
+
if RUBY_VERSION >= "2.2.0"
|
7
|
+
gem 'activerecord', '>= 4.0.0', :require => 'active_record'
|
8
|
+
gem 'padrino-helpers'
|
9
|
+
else
|
10
|
+
gem 'activerecord', '~> 3.2.3', :require => 'active_record'
|
11
|
+
gem 'padrino-helpers', '~> 0.10.6'
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'rack-test'
|
15
|
+
gem 'sinatra-contrib'
|
16
|
+
gem 'rspec', '~> 2.14.1'
|
17
|
+
gem 'mime-types', '2.99' if RUBY_VERSION == '1.9.3'
|
18
|
+
|
19
|
+
platforms :ruby do
|
20
|
+
if RUBY_VERSION > "2.1.0"
|
21
|
+
gem 'sqlite3'
|
22
|
+
else
|
23
|
+
gem 'sqlite3', '1.3.8'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
platforms :jruby do
|
27
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
28
|
+
end
|
29
|
+
platforms :rbx do
|
30
|
+
gem 'rubysl', '~> 2.0'
|
31
|
+
gem 'racc'
|
32
|
+
gem 'rubysl-test-unit'
|
33
|
+
gem 'rubinius-developer_tools'
|
34
|
+
end
|
35
|
+
|
36
|
+
gemspec :path => '../'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'sinatra', '~> 1.4.0'
|
4
|
+
gem 'rspec', '~> 2.14.1'
|
5
|
+
|
6
|
+
gem 'activerecord', '>= 4.0.0', :require => 'active_record'
|
7
|
+
gem 'padrino-helpers', '~> 0.12.0'
|
8
|
+
|
9
|
+
gem 'rack-test', '>= 0'
|
10
|
+
gem 'sinatra-contrib', '~> 1.4.0'
|
11
|
+
|
12
|
+
if RUBY_VERSION == '1.9.3'
|
13
|
+
gem 'mime-types', '2.99'
|
14
|
+
end
|
15
|
+
|
16
|
+
platforms :ruby do
|
17
|
+
if RUBY_VERSION > "2.1.0"
|
18
|
+
gem 'sqlite3'
|
19
|
+
else
|
20
|
+
gem 'sqlite3', '1.3.8'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
platforms :jruby do
|
24
|
+
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
|
25
|
+
end
|
26
|
+
platforms :rbx do
|
27
|
+
gem 'rubysl', '~> 2.0'
|
28
|
+
gem 'racc'
|
29
|
+
gem 'rubysl-test-unit'
|
30
|
+
gem 'rubinius-developer_tools'
|
31
|
+
end
|
32
|
+
|
33
|
+
gemspec :path => '../'
|
data/kaminari.gemspec
CHANGED
@@ -6,11 +6,11 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'kaminari'
|
7
7
|
s.version = Kaminari::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['Akira Matsuda']
|
9
|
+
s.authors = ['Akira Matsuda', 'Yuki Nishijima', 'Zachary Scott', 'Hiroshi Shibata']
|
10
10
|
s.email = ['ronnie@dio.jp']
|
11
11
|
s.homepage = 'https://github.com/amatsuda/kaminari'
|
12
|
-
s.summary = 'A pagination engine plugin for Rails 3
|
13
|
-
s.description = 'Kaminari is a Scope & Engine based, clean, powerful, agnostic, customizable and sophisticated paginator for Rails 3'
|
12
|
+
s.summary = 'A pagination engine plugin for Rails 3+ and other modern frameworks'
|
13
|
+
s.description = 'Kaminari is a Scope & Engine based, clean, powerful, agnostic, customizable and sophisticated paginator for Rails 3+'
|
14
14
|
|
15
15
|
s.rubyforge_project = 'kaminari'
|
16
16
|
|
@@ -21,16 +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 '
|
30
|
-
s.add_development_dependency '
|
31
|
-
s.add_development_dependency '
|
32
|
-
s.add_development_dependency '
|
33
|
-
s.add_development_dependency '
|
34
|
-
s.add_development_dependency '
|
35
|
-
s.add_development_dependency 'rdoc', ['>= 0']
|
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'
|
36
35
|
end
|
@@ -24,11 +24,12 @@ BANNER
|
|
24
24
|
def copy_or_fetch #:nodoc:
|
25
25
|
return copy_default_views if file_name == 'default'
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
if theme = self.class.themes.detect {|t| t.name == file_name}
|
28
|
+
if download_templates(theme).empty?
|
29
|
+
say %Q[template_engine: #{template_engine} is not available for theme: #{file_name}]
|
30
|
+
end
|
30
31
|
else
|
31
|
-
say %Q[no such theme: #{file_name}\n avaliable themes: #{themes.map(&:name).join ", "}]
|
32
|
+
say %Q[no such theme: #{file_name}\n avaliable themes: #{self.class.themes.map(&:name).join ", "}]
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -89,17 +90,17 @@ BANNER
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def templates_for(template_engine) #:nodoc:
|
92
|
-
@templates.select {|t|
|
93
|
+
@templates.select {|t| t.engine == template_engine }
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
96
97
|
module GitHubApiHelper
|
97
98
|
def get_files_in_master
|
98
99
|
master_tree_sha = open('https://api.github.com/repos/amatsuda/kaminari_themes/git/refs/heads/master') do |json|
|
99
|
-
ActiveSupport::JSON.decode(json)['object']['sha']
|
100
|
+
ActiveSupport::JSON.decode(json.read)['object']['sha']
|
100
101
|
end
|
101
102
|
open('https://api.github.com/repos/amatsuda/kaminari_themes/git/trees/' + master_tree_sha + '?recursive=1') do |json|
|
102
|
-
blobs = ActiveSupport::JSON.decode(json)['tree'].find_all {|i| i['type'] == 'blob' }
|
103
|
+
blobs = ActiveSupport::JSON.decode(json.read)['tree'].find_all {|i| i['type'] == 'blob' }
|
103
104
|
blobs.map do |blob|
|
104
105
|
[blob['path'], blob['sha']]
|
105
106
|
end
|
@@ -109,7 +110,7 @@ BANNER
|
|
109
110
|
|
110
111
|
def get_content_for(path)
|
111
112
|
open('https://api.github.com/repos/amatsuda/kaminari_themes/contents/' + path) do |json|
|
112
|
-
Base64.decode64(ActiveSupport::JSON.decode(json)['content'])
|
113
|
+
Base64.decode64(ActiveSupport::JSON.decode(json.read)['content'])
|
113
114
|
end
|
114
115
|
end
|
115
116
|
module_function :get_content_for
|
data/lib/kaminari/config.rb
CHANGED
@@ -24,6 +24,7 @@ module Kaminari
|
|
24
24
|
config_accessor :left
|
25
25
|
config_accessor :right
|
26
26
|
config_accessor :page_method_name
|
27
|
+
config_accessor :max_pages
|
27
28
|
|
28
29
|
def param_name
|
29
30
|
config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
|
@@ -45,5 +46,6 @@ module Kaminari
|
|
45
46
|
config.right = 0
|
46
47
|
config.page_method_name = :page
|
47
48
|
config.param_name = :page
|
49
|
+
config.max_pages = nil
|
48
50
|
end
|
49
51
|
end
|
@@ -15,7 +15,9 @@ module Kaminari
|
|
15
15
|
# * <tt>:remote</tt> - Ajax? (false by default)
|
16
16
|
# * <tt>:ANY_OTHER_VALUES</tt> - Any other hash key & values would be directly passed into each tag as :locals value.
|
17
17
|
def paginate(scope, options = {}, &block)
|
18
|
-
|
18
|
+
options[:total_pages] ||= options[:num_pages] || scope.total_pages
|
19
|
+
|
20
|
+
paginator = Kaminari::Helpers::Paginator.new(self, options.reverse_merge(:current_page => scope.current_page, :per_page => scope.limit_value, :remote => false))
|
19
21
|
paginator.to_s
|
20
22
|
end
|
21
23
|
|
@@ -39,7 +41,7 @@ module Kaminari
|
|
39
41
|
def link_to_previous_page(scope, name, options = {}, &block)
|
40
42
|
params = options.delete(:params) || {}
|
41
43
|
param_name = options.delete(:param_name) || Kaminari.config.param_name
|
42
|
-
link_to_unless scope.first_page?, name, params.merge(param_name =>
|
44
|
+
link_to_unless scope.first_page?, name, params.merge(param_name => scope.prev_page), options.reverse_merge(:rel => 'previous') do
|
43
45
|
block.call if block
|
44
46
|
end
|
45
47
|
end
|
@@ -64,7 +66,7 @@ module Kaminari
|
|
64
66
|
def link_to_next_page(scope, name, options = {}, &block)
|
65
67
|
params = options.delete(:params) || {}
|
66
68
|
param_name = options.delete(:param_name) || Kaminari.config.param_name
|
67
|
-
link_to_unless scope.last_page?, name, params.merge(param_name =>
|
69
|
+
link_to_unless scope.last_page?, name, params.merge(param_name => scope.next_page), options.reverse_merge(:rel => 'next') do
|
68
70
|
block.call if block
|
69
71
|
end
|
70
72
|
end
|
@@ -86,24 +88,14 @@ module Kaminari
|
|
86
88
|
# <%= page_entries_info @posts, :entry_name => 'item' %>
|
87
89
|
# #-> Displaying items 6 - 10 of 26 in total
|
88
90
|
def page_entries_info(collection, options = {})
|
89
|
-
entry_name =
|
90
|
-
options[:entry_name]
|
91
|
-
elsif collection.empty? || collection.is_a?(PaginatableArray)
|
92
|
-
'entry'
|
93
|
-
else
|
94
|
-
if collection.respond_to? :model # DataMapper
|
95
|
-
collection.model.model_name.human.downcase
|
96
|
-
else # AR
|
97
|
-
collection.model_name.human.downcase
|
98
|
-
end
|
99
|
-
end
|
91
|
+
entry_name = options[:entry_name] || collection.entry_name
|
100
92
|
entry_name = entry_name.pluralize unless collection.total_count == 1
|
101
93
|
|
102
94
|
if collection.total_pages < 2
|
103
95
|
t('helpers.page_entries_info.one_page.display_entries', :entry_name => entry_name, :count => collection.total_count)
|
104
96
|
else
|
105
97
|
first = collection.offset_value + 1
|
106
|
-
last = collection.
|
98
|
+
last = (sum = collection.offset_value + collection.limit_value) > collection.total_count ? collection.total_count : sum
|
107
99
|
t('helpers.page_entries_info.more_pages.display_entries', :entry_name => entry_name, :first => first, :last => last, :total => collection.total_count)
|
108
100
|
end.html_safe
|
109
101
|
end
|
@@ -131,21 +123,10 @@ module Kaminari
|
|
131
123
|
param_name = options.delete(:param_name) || Kaminari.config.param_name
|
132
124
|
|
133
125
|
output = ""
|
134
|
-
|
135
|
-
|
136
|
-
# If not first and not last, then output both links.
|
137
|
-
output << '<link rel="next" href="' + url_for(params.merge(param_name => (scope.current_page + 1))) + '"/>'
|
138
|
-
output << '<link rel="prev" href="' + url_for(params.merge(param_name => (scope.current_page - 1))) + '"/>'
|
139
|
-
elsif scope.first_page?
|
140
|
-
# If first page, add next link unless last page.
|
141
|
-
output << '<link rel="next" href="' + url_for(params.merge(param_name => (scope.current_page + 1))) + '"/>' unless scope.last_page?
|
142
|
-
else
|
143
|
-
# If last page, add prev link unless first page.
|
144
|
-
output << '<link rel="prev" href="' + url_for(params.merge(param_name => (scope.current_page - 1))) + '"/>' unless scope.first_page?
|
145
|
-
end
|
126
|
+
output << '<link rel="next" href="' + url_for(params.merge(param_name => scope.next_page, :only_path => true)) + '"/>' if scope.next_page
|
127
|
+
output << '<link rel="prev" href="' + url_for(params.merge(param_name => scope.prev_page, :only_path => true)) + '"/>' if scope.prev_page
|
146
128
|
|
147
129
|
output.html_safe
|
148
130
|
end
|
149
|
-
|
150
131
|
end
|
151
132
|
end
|