end
end
+ def multiple_pages?
+ per_page < item_count
+ end
+
def first_item
item_count == 0 ? 0 : (offset + 1)
end
page_param = paginator.page_param
html = '<ul class="pages">'
- if paginator.previous_page
+
+ if paginator.multiple_pages?
# \xc2\xab(utf-8) = «
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
previous = page
end
- if paginator.next_page
+ if paginator.multiple_pages?
# \xc2\xbb(utf-8) = »
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>'