diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-08-26 09:48:01 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-08-29 09:44:33 +0100 |
commit | 5f0c0d59ded4301efa085c4103b84a42a9fa61f6 (patch) | |
tree | f759c7d7fee8a7004b5d94b5144d37fe512534cf /app/helpers/link_to_helper.rb | |
parent | d5384ba1b739c7ca3a8fcab4cdda35965d33c6ee (diff) |
Further work in progress on better search functionality
Diffstat (limited to 'app/helpers/link_to_helper.rb')
-rwxr-xr-x | app/helpers/link_to_helper.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 1299e53eb..54b8d69d0 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -135,11 +135,10 @@ module LinkToHelper end end - # General pages. postfix is either the sort order, or 'bodies' to show you - # came from the front page and are looking for public bodies - def search_url(query, postfix = nil) + # General pages. + def search_url(query, variety_postfix = nil, sort_postfix = nil, advanced = nil) + query = query - ["", nil] if query.kind_of?(Array) url = search_general_url(:combined => query) - # Here we can't escape the slashes, as RFC 2396 doesn't allow slashes # within a path component. Rails is assuming when generating URLs that # either there aren't slashes, or we are in a query part where you can @@ -151,13 +150,19 @@ module LinkToHelper # http://rails.lighthouseapp.com/projects/8994/tickets/144-patch-bug-in-rails-route-globbing url = url.gsub("%2F", "/") - if !postfix.nil? && !postfix.empty? - url = url + "/" + postfix + if !variety_postfix.nil? && !variety_postfix.empty? + url = url + "/" + variety_postfix + end + if !sort_postfix.nil? && !sort_postfix.empty? + url = url + "/" + sort_postfix + end + if !advanced.nil? && (advanced) + url = url + "/advanced" end return url end - def search_link(query, postfix = nil) - link_to h(query), search_url(query, postfix) + def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil) + link_to h(query), search_url(query, variety_postfix, sort_postfix, advanced) end # Admin pages |