Class: Library::LinkRenderer

Inherits:
WillPaginate::LinkRenderer
  • Object
show all
Defined in:
lib/link_renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ LinkRenderer

Returns a new instance of LinkRenderer.



7
8
9
# File 'lib/link_renderer.rb', line 7

def initialize(tag)
  @tag = tag
end

Instance Method Details



11
12
13
14
15
# File 'lib/link_renderer.rb', line 11

def page_link(page, text, attributes = {})
  linkclass = %{ class="#{attributes[:class]}"} if attributes[:class]
  linkrel = %{ rel="#{attributes[:rel]}"} if attributes[:rel]
  %Q{<a href="#{@tag.locals.page.url}?page=#{page}"#{linkrel}#{linkclass}>#{text}</a>}
end

#page_span(page, text, attributes = {}) ⇒ Object



17
18
19
20
# File 'lib/link_renderer.rb', line 17

def page_span(page, text, attributes = {})
  spanclass = attributes[:class]
  %{<span class="#{attributes[:class]}">#{text}</span>}
end