diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-26 01:03:35 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-26 01:03:35 +0000 |
commit | 673b5cc3939e9abc3bc1f5984f2a61ed45b70529 (patch) | |
tree | 5b02800891270972a8946518f37fb807f2b9b7d8 /app/helpers/link_to_helper.rb | |
parent | 0e546a79b205124d7b95b89e4a2e9cc520a4fc10 (diff) | |
parent | 6d7bea575ec185379efb648f6bbbd520029e3a91 (diff) |
Merge branch 'release/0.5' into develop
Diffstat (limited to 'app/helpers/link_to_helper.rb')
-rwxr-xr-x | app/helpers/link_to_helper.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 7903dee2a..56c33e512 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -136,9 +136,19 @@ module LinkToHelper end # 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) + def search_url(query, params = nil) + if query.kind_of?(Array) + query = query - ["", nil] + query = query.join("/") + end + routing_info = {:controller => 'general', + :action => 'search', + :combined => query, + :view => nil} + if !params.nil? + routing_info = params.merge(routing_info) + end + url = url_for(routing_info) # 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 @@ -150,19 +160,10 @@ module LinkToHelper # http://rails.lighthouseapp.com/projects/8994/tickets/144-patch-bug-in-rails-route-globbing url = url.gsub("%2F", "/") - 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, variety_postfix = nil, sort_postfix = nil, advanced = nil) - link_to h(query), search_url(query, variety_postfix, sort_postfix, advanced) + link_to h(query), search_url(query) end # Admin pages |