1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Issue #310 fixed. Refactored code to use a single method to know if a tag page should be displayed.

This commit is contained in:
Anthony Alberto 2013-02-10 16:44:53 -08:00 committed by Akira Matsuda
parent 93dd05ed05
commit 9e181739e8
4 changed files with 8 additions and 3 deletions

View file

@ -11,7 +11,7 @@
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<% if page.display_tag? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>

View file

@ -10,7 +10,7 @@
= first_page_tag unless current_page.first?
= prev_page_tag unless current_page.first?
- each_page do |page|
- if page.left_outer? || page.right_outer? || page.inside_window?
- if page.display_tag?
= page_tag page
- elsif !page.was_truncated?
= gap_tag

View file

@ -11,7 +11,7 @@
== first_page_tag unless current_page.first?
== prev_page_tag unless current_page.first?
- each_page do |page|
- if page.left_outer? || page.right_outer? || page.inside_window?
- if page.display_tag?
== page_tag page
- elsif !page.was_truncated?
== gap_tag

View file

@ -159,6 +159,11 @@ module Kaminari
@last.is_a? Gap
end
#Should we display the link tag?
def display_tag?
left_outer? || right_outer? || inside_window? || single_gap?
end
def to_i #:nodoc:
number
end