mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Merge pull request #712 from igorkasyanchuk/master
hide Next & Last buttons if page is out of range
This commit is contained in:
commit
be3a2c9a21
2 changed files with 11 additions and 2 deletions
|
@ -17,7 +17,9 @@
|
|||
<%= gap_tag %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% unless current_page.out_of_range? %>
|
||||
<%= next_page_tag unless current_page.last? %>
|
||||
<%= last_page_tag unless current_page.last? %>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% end -%>
|
||||
|
|
|
@ -36,6 +36,13 @@ describe 'Kaminari::ActionViewExtension', :if => defined?(::Rails::Railtie) && d
|
|||
subject { helper.paginate @users, :total_pages => 3, :params => {:controller => 'users', :action => 'index'} }
|
||||
it { should match(/<a href="\/users\?page=3">Last/) }
|
||||
end
|
||||
|
||||
context "page: 20 (out of range)" do
|
||||
before { @users = User.page(20) }
|
||||
subject { helper.paginate @users, :params => {:controller => 'users', :action => 'index'} }
|
||||
it { should_not match(/Last/) }
|
||||
it { should_not match(/Next/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#link_to_previous_page' do
|
||||
|
|
Loading…
Reference in a new issue