diff options
| author | hukl <contact@smyck.org> | 2009-10-08 22:25:12 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-10-08 22:25:12 +0200 |
| commit | b7c233271b072ba408bfa9e9e8cc6fde7726c558 (patch) | |
| tree | 5e2db6bc9aebd0b31f359459d589fd8b0eb5dabd | |
| parent | 2fd33c36428ae7684badc43dbe2142152f058b4e (diff) | |
fixed the helper to merge the html options properly
| -rw-r--r-- | app/helpers/link_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index e5fc632..65137ee 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb | |||
| @@ -18,6 +18,10 @@ module LinkHelper | |||
| 18 | active = (params[:page_path].join("/") == path.sub(/^\//, "")) | 18 | active = (params[:page_path].join("/") == path.sub(/^\//, "")) |
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | active_class = active ? {:class => 'active'} : {:class => 'inactive'} | ||
| 22 | |||
| 23 | html_options = html_options.merge(active_class) | ||
| 24 | |||
| 21 | params[:locale] ||= I18n.locale | 25 | params[:locale] ||= I18n.locale |
| 22 | 26 | ||
| 23 | link_to( | 27 | link_to( |
| @@ -27,7 +31,7 @@ module LinkHelper | |||
| 27 | :locale => params[:locale], | 31 | :locale => params[:locale], |
| 28 | :page_path => path.sub(/^\//, "").split("/") | 32 | :page_path => path.sub(/^\//, "").split("/") |
| 29 | }, | 33 | }, |
| 30 | active ? {:class => 'active'} : {:class => 'inactive'} | 34 | html_options |
| 31 | ) | 35 | ) |
| 32 | end | 36 | end |
| 33 | 37 | ||
