aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/search_helper.rb
diff options
context:
space:
mode:
authorAlban Peignier2012-03-11 11:54:00 +0100
committerAlban Peignier2012-03-11 11:54:12 +0100
commitdc8a6f7f9182996ea3f39986b45c3a71927a8e4a (patch)
treef6c2e5c48a896dc43f8c0795eb1f557b82483c80 /app/helpers/search_helper.rb
parentae88454853f146acc6f1368a14e1180be2650d03 (diff)
downloadchouette-core-dc8a6f7f9182996ea3f39986b45c3a71927a8e4a.tar.bz2
Add validations. Fixes specs
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r--app/helpers/search_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
new file mode 100644
index 000000000..eaeac99d8
--- /dev/null
+++ b/app/helpers/search_helper.rb
@@ -0,0 +1,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), html_options
+ end
+
+end