1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Merge pull request #177 from webmat/override_rel

Let one override the rel= attribute
This commit is contained in:
Akira Matsuda 2011-12-10 10:02:10 -08:00
commit f2664f0086
2 changed files with 10 additions and 3 deletions

View file

@ -41,7 +41,7 @@ module Kaminari
def link_to_next_page(scope, name, options = {}, &block)
params = options.delete(:params) || {}
param_name = options.delete(:param_name) || Kaminari.config.param_name
link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), options.merge(:rel => 'next') do
link_to_unless scope.last_page?, name, params.merge(param_name => (scope.current_page + 1)), options.reverse_merge(:rel => 'next') do
block.call if block
end
end

View file

@ -24,8 +24,15 @@ describe 'Kaminari::ActionViewExtension' do
before do
@users = User.page(1)
end
subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
it { should be_a String }
context 'the default behaviour' do
subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
it { should be_a String }
it { should match /rel="next"/ }
end
context 'overriding rel=' do
subject { helper.link_to_next_page @users, 'More', :rel => 'external', :params => {:controller => 'users', :action => 'index'} }
it { should match /rel="external"/ }
end
end
context 'the last page' do
before do