Class: SphinxSearch::LinkRenderer
- Inherits:
-
Radiant::Pagination::LinkRenderer
- Object
- Radiant::Pagination::LinkRenderer
- SphinxSearch::LinkRenderer
- Defined in:
- lib/sphinx_search/link_renderer.rb
Instance Method Summary collapse
-
#initialize(url_stem, query) ⇒ LinkRenderer
constructor
A new instance of LinkRenderer.
- #page_link(page, text, attributes = {}) ⇒ Object
Constructor Details
#initialize(url_stem, query) ⇒ LinkRenderer
Returns a new instance of LinkRenderer.
3 4 5 |
# File 'lib/sphinx_search/link_renderer.rb', line 3 def initialize(url_stem, query) @url_stem, @query = url_stem, query end |
Instance Method Details
#page_link(page, text, attributes = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/sphinx_search/link_renderer.rb', line 7 def page_link(page, text, attributes = {}) linkclass = %{ class="#{attributes[:class]}"} if attributes[:class] linkrel = %{ rel="#{attributes[:rel]}"} if attributes[:rel] page_param_name = WillPaginate::ViewHelpers.[:param_name] search_param_name = SphinxSearch.param_name || 'q' %Q{<a href="#{@url_stem}?#{search_param_name}=#{@query}&#{page_param_name}=#{page}"#{linkrel}#{linkclass}>#{text}</a>} end |