class DidPaginate::PageItem
Constants
- ACTIVE_CLASS
- DISABLED_CLASS
- NULL_URL
Attributes
content[RW]
url[RW]
Public Class Methods
new(url, content, is_current)
click to toggle source
# File lib/did_paginate/page_item.rb, line 11 def initialize(url, content, is_current) @url = url || NULL_URL @content = content @is_current = is_current end
Public Instance Methods
is_current?()
click to toggle source
# File lib/did_paginate/page_item.rb, line 17 def is_current? @is_current end
is_linkable?()
click to toggle source
# File lib/did_paginate/page_item.rb, line 21 def is_linkable? @url != NULL_URL end
render(template)
click to toggle source
# File lib/did_paginate/page_item.rb, line 25 def render(template) template.content_tag(:li, template.link_to(@content, @url), class: item_class) end
Protected Instance Methods
item_class()
click to toggle source
# File lib/did_paginate/page_item.rb, line 31 def item_class return ACTIVE_CLASS if is_current? DISABLED_CLASS unless is_linkable? end