Class: SphinxSearch::LinkRenderer

Inherits:
Radiant::Pagination::LinkRenderer
  • Object
show all
Defined in:
lib/sphinx_search/link_renderer.rb

Instance Method Summary collapse

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



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.pagination_options[: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