mirror of
https://github.com/redmine/redmine.git
synced 2025-11-11 15:56:03 +01:00
Don't generate urls with params.
git-svn-id: http://svn.redmine.org/redmine/trunk@15631 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
</span>
|
||||
|
||||
<% 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 %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
|
||||
@@ -345,8 +345,8 @@
|
||||
</table>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'PDF', :url => params.merge(@gantt.params) %>
|
||||
<%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %>
|
||||
<%= f.link_to_with_query_parameters 'PDF', @gantt.params %>
|
||||
<%= f.link_to_with_query_parameters('PNG', @gantt.params) if @gantt.respond_to?('to_image') %>
|
||||
<% end %>
|
||||
<% end # query.valid? %>
|
||||
|
||||
|
||||
@@ -76,9 +76,9 @@
|
||||
<% end %>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
||||
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
|
||||
<%= f.link_to 'PDF', :url => params %>
|
||||
<%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %>
|
||||
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
|
||||
<%= f.link_to_with_query_parameters 'PDF' %>
|
||||
<% end %>
|
||||
|
||||
<div id="csv-export-options" style="display:none;">
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<% end -%>
|
||||
|
||||
<% 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 %>
|
||||
|
||||
<% html_title(with_leading_slash(@path), 'Diff') -%>
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :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 'Atom', :key => User.current.rss_key %>
|
||||
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||||
<% end %>
|
||||
|
||||
<div id="csv-export-options" style="display:none;">
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -123,7 +123,7 @@ class IssuesTest < Redmine::IntegrationTest
|
||||
get '/issues', :project_id => 'ecookbook'
|
||||
|
||||
%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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user