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:
parent
93dd05ed05
commit
9e181739e8
4 changed files with 8 additions and 3 deletions
|
@ -11,7 +11,7 @@
|
||||||
<%= first_page_tag unless current_page.first? %>
|
<%= first_page_tag unless current_page.first? %>
|
||||||
<%= prev_page_tag unless current_page.first? %>
|
<%= prev_page_tag unless current_page.first? %>
|
||||||
<% each_page do |page| -%>
|
<% each_page do |page| -%>
|
||||||
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
<% if page.display_tag? -%>
|
||||||
<%= page_tag page %>
|
<%= page_tag page %>
|
||||||
<% elsif !page.was_truncated? -%>
|
<% elsif !page.was_truncated? -%>
|
||||||
<%= gap_tag %>
|
<%= gap_tag %>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
= first_page_tag unless current_page.first?
|
= first_page_tag unless current_page.first?
|
||||||
= prev_page_tag unless current_page.first?
|
= prev_page_tag unless current_page.first?
|
||||||
- each_page do |page|
|
- each_page do |page|
|
||||||
- if page.left_outer? || page.right_outer? || page.inside_window?
|
- if page.display_tag?
|
||||||
= page_tag page
|
= page_tag page
|
||||||
- elsif !page.was_truncated?
|
- elsif !page.was_truncated?
|
||||||
= gap_tag
|
= gap_tag
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
== first_page_tag unless current_page.first?
|
== first_page_tag unless current_page.first?
|
||||||
== prev_page_tag unless current_page.first?
|
== prev_page_tag unless current_page.first?
|
||||||
- each_page do |page|
|
- each_page do |page|
|
||||||
- if page.left_outer? || page.right_outer? || page.inside_window?
|
- if page.display_tag?
|
||||||
== page_tag page
|
== page_tag page
|
||||||
- elsif !page.was_truncated?
|
- elsif !page.was_truncated?
|
||||||
== gap_tag
|
== gap_tag
|
||||||
|
|
|
@ -159,6 +159,11 @@ module Kaminari
|
||||||
@last.is_a? Gap
|
@last.is_a? Gap
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Should we display the link tag?
|
||||||
|
def display_tag?
|
||||||
|
left_outer? || right_outer? || inside_window? || single_gap?
|
||||||
|
end
|
||||||
|
|
||||||
def to_i #:nodoc:
|
def to_i #:nodoc:
|
||||||
number
|
number
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue