aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/link_to_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/link_to_helper.rb')
-rwxr-xr-xapp/helpers/link_to_helper.rb27
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