mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Fixed a bug where the range of the records displayed on the last page doesn't match
closes #718
This commit is contained in:
parent
03ffb28ec3
commit
17d0fb83aa
2 changed files with 13 additions and 1 deletions
|
@ -95,7 +95,7 @@ module Kaminari
|
||||||
t('helpers.page_entries_info.one_page.display_entries', :entry_name => entry_name, :count => collection.total_count)
|
t('helpers.page_entries_info.one_page.display_entries', :entry_name => entry_name, :count => collection.total_count)
|
||||||
else
|
else
|
||||||
first = collection.offset_value + 1
|
first = collection.offset_value + 1
|
||||||
last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
|
last = (sum = collection.offset_value + collection.limit_value) > collection.total_count ? collection.total_count : sum
|
||||||
t('helpers.page_entries_info.more_pages.display_entries', :entry_name => entry_name, :first => first, :last => last, :total => collection.total_count)
|
t('helpers.page_entries_info.more_pages.display_entries', :entry_name => entry_name, :first => first, :last => last, :total => collection.total_count)
|
||||||
end.html_safe
|
end.html_safe
|
||||||
end
|
end
|
||||||
|
|
|
@ -209,6 +209,18 @@ describe 'Kaminari::ActionViewExtension', :if => defined?(Rails) do
|
||||||
it { should == 'Displaying members <b>26 - 50</b> of <b>50</b> in total' }
|
it { should == 'Displaying members <b>26 - 50</b> of <b>50</b> in total' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'the last page' do
|
||||||
|
before do
|
||||||
|
User.max_pages_per 4
|
||||||
|
@users = User.page(4).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
after { User.max_pages_per nil }
|
||||||
|
|
||||||
|
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
|
||||||
|
it { should == 'Displaying users <b>31 - 40</b> of <b>50</b> in total' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'on a model with namespace' do
|
context 'on a model with namespace' do
|
||||||
|
|
Loading…
Reference in a new issue