aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/search_helper.rb
blob: f4976ea532a28883551cce895b7f4fd00893966e (plain)
1
2
3
4
5
6
7
8
9
10
11
module SearchHelper

  def link_with_search(name, search, html_options = {})
    is_current = (@q and search.all? { |k,v| @q.send(k) == v })
    if is_current
      html_options[:class] = [html_options[:class], "current"].compact.join(" ")
    end
    link_to name, params.deep_merge("q" => search,:page => 1), html_options
  end

end