Commit 72332da1 authored by jplang's avatar jplang

Don't generate urls with params.

git-svn-id: https://svn.redmine.org/redmine/trunk@15631 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent f16fb97f
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</span> </span>
&nbsp; &nbsp;
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %> <%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.rss_key %>
<% end %> <% end %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
......
...@@ -345,8 +345,8 @@ ...@@ -345,8 +345,8 @@
</table> </table>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'PDF', :url => params.merge(@gantt.params) %> <%= f.link_to_with_query_parameters 'PDF', @gantt.params %>
<%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %> <%= f.link_to_with_query_parameters('PNG', @gantt.params) if @gantt.respond_to?('to_image') %>
<% end %> <% end %>
<% end # query.valid? %> <% end # query.valid? %>
......
...@@ -76,9 +76,9 @@ ...@@ -76,9 +76,9 @@
<% end %> <% end %>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> <%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %>
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '350px'); return false;" %> <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
<%= f.link_to 'PDF', :url => params %> <%= f.link_to_with_query_parameters 'PDF' %>
<% end %> <% end %>
<div id="csv-export-options" style="display:none;"> <div id="csv-export-options" style="display:none;">
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<% end -%> <% end -%>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Diff', :url => params, :caption => 'Unified diff' %> <%= f.link_to_with_query_parameters 'Diff', {}, :caption => 'Unified diff' %>
<% end %> <% end %>
<% html_title(with_leading_slash(@path), 'Diff') -%> <% html_title(with_leading_slash(@path), 'Diff') -%>
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span> <span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %> <%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %>
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
<% end %> <% end %>
<div id="csv-export-options" style="display:none;"> <div id="csv-export-options" style="display:none;">
......
...@@ -28,6 +28,16 @@ module Redmine ...@@ -28,6 +28,16 @@ module Redmine
html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options) html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options)
@view.content_tag('span', @view.link_to(caption, url, html_options)) @view.content_tag('span', @view.link_to(caption, url, html_options))
end 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 end
end end
...@@ -123,7 +123,7 @@ class IssuesTest < Redmine::IntegrationTest ...@@ -123,7 +123,7 @@ class IssuesTest < Redmine::IntegrationTest
get '/issues', :project_id => 'ecookbook' get '/issues', :project_id => 'ecookbook'
%w(Atom PDF CSV).each do |format| %w(Atom PDF CSV).each do |format|
assert_select 'a[rel=nofollow][href=?]', "/projects/ecookbook/issues.#{format.downcase}", :text => format assert_select 'a[rel=nofollow][href=?]', "/issues.#{format.downcase}?project_id=ecookbook", :text => format
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment