afimb/chouette2

View on GitHub
app/helpers/search_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
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