summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-10 19:18:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-10 19:18:12 +0000
commitb2044e6dfc261656ee477fa0287c98bda3fa183d (patch)
treeb9d50e229eb6d18ad97a05333c3c37c7ded692bd /lib
parent731eadc4502f7fccc85dcc2ab4c29a9da4f5a415 (diff)
downloadredmine-b2044e6dfc261656ee477fa0287c98bda3fa183d.tar.gz
redmine-b2044e6dfc261656ee477fa0287c98bda3fa183d.zip
Don't generate urls with params.
git-svn-id: http://svn.redmine.org/redmine/trunk@15631 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/views/other_formats_builder.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/redmine/views/other_formats_builder.rb b/lib/redmine/views/other_formats_builder.rb
index 48af0fbcb..4caee2142 100644
--- a/lib/redmine/views/other_formats_builder.rb
+++ b/lib/redmine/views/other_formats_builder.rb
@@ -28,6 +28,16 @@ module Redmine
html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options)
@view.content_tag('span', @view.link_to(caption, url, html_options))
end
+
+ # Preserves query parameters
+ def link_to_with_query_parameters(name, url={}, options={})
+ params = @view.request.query_parameters.except(:page, :format).except(*url.keys)
+ url = {:params => params, :page => nil, :format => name.to_s.downcase}.merge(url)
+
+ caption = options.delete(:caption) || name
+ html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options)
+ @view.content_tag('span', @view.link_to(caption, url, html_options))
+ end
end
end
end