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:
commit
f2664f0086
2 changed files with 10 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue