Always show previous/next when there are more than one page.

git-svn-id: http://svn.redmine.org/redmine/trunk@14901 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2015-11-28 12:24:23 +00:00
parent 053f2d7bd0
commit 4a77bfa44d

View File

@@ -67,6 +67,10 @@ module Redmine
end
end
def multiple_pages?
per_page < item_count
end
def first_item
item_count == 0 ? 0 : (offset + 1)
end
@@ -173,13 +177,18 @@ module Redmine
page_param = paginator.page_param
html = '<ul class="pages">'
if paginator.previous_page
if paginator.multiple_pages?
# \xc2\xab(utf-8) = &#171;
text = "\xc2\xab " + l(:label_previous)
html << content_tag('li',
yield(text, {page_param => paginator.previous_page},
:accesskey => accesskey(:previous)),
:class => 'previous page')
if paginator.previous_page
html << content_tag('li',
yield(text, {page_param => paginator.previous_page},
:accesskey => accesskey(:previous)),
:class => 'previous page')
else
html << content_tag('li', content_tag('span', text), :class => 'previous')
end
end
previous = nil
@@ -197,13 +206,17 @@ module Redmine
previous = page
end
if paginator.next_page
if paginator.multiple_pages?
# \xc2\xbb(utf-8) = &#187;
text = l(:label_next) + " \xc2\xbb"
html << content_tag('li',
yield(text, {page_param => paginator.next_page},
:accesskey => accesskey(:next)),
:class => 'next page')
if paginator.next_page
html << content_tag('li',
yield(text, {page_param => paginator.next_page},
:accesskey => accesskey(:next)),
:class => 'next page')
else
html << content_tag('li', content_tag('span', text), :class => 'next')
end
end
html << '</ul>'