Class: Library::LinkRenderer
- Inherits:
-
WillPaginate::LinkRenderer
- Object
- WillPaginate::LinkRenderer
- Library::LinkRenderer
- Defined in:
- lib/library/link_renderer.rb
Instance Method Summary collapse
-
#initialize(tag) ⇒ LinkRenderer
constructor
A new instance of LinkRenderer.
- #page_link(page, text, attributes = {}) ⇒ Object
- #page_span(page, text, attributes = {}) ⇒ Object
Constructor Details
#initialize(tag) ⇒ LinkRenderer
Returns a new instance of LinkRenderer.
7 8 9 |
# File 'lib/library/link_renderer.rb', line 7 def initialize(tag) @tag = tag end |
Instance Method Details
#page_link(page, text, attributes = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/library/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/library/link_renderer.rb', line 17 def page_span(page, text, attributes = {}) spanclass = attributes[:class] %{<span class="#{attributes[:class]}">#{text}</span>} end |