Fixes that diff of a javascript file in repository module is not displayed with layout in Rails 7.1

(#39747, #36320).

git-svn-id: https://svn.redmine.org/redmine/trunk@22563 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2023-12-26 15:47:43 +00:00
parent 5a5c621f43
commit a9b7f12900
3 changed files with 9 additions and 8 deletions

View File

@@ -48,7 +48,7 @@
<% end -%> <% end -%>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to_with_query_parameters 'Diff', {}, :caption => 'Unified diff' %> <%= f.link_to_with_query_parameters 'Diff', { path: nil }, :caption => 'Unified diff' %>
<% end %> <% end %>
<% html_title(with_leading_slash(@path), 'Diff') -%> <% html_title(with_leading_slash(@path), 'Diff') -%>

View File

@@ -299,12 +299,13 @@ Rails.application.routes.draw do
get "projects/:id/repository/:repository_id/revisions/:rev/diff(/*path)", get "projects/:id/repository/:repository_id/revisions/:rev/diff(/*path)",
:to => 'repositories#diff', :to => 'repositories#diff',
:format => false, :format => 'html',
:constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/} :constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/, format: /(html|diff)/ }
get "projects/:id/repository/:repository_id/diff(/*path)", get "projects/:id/repository/:repository_id/diff(/*path)",
:to => 'repositories#diff', :to => 'repositories#diff',
:format => false, :format => 'html',
:constraints => {:path => /.*/} :constraints => {:path => /.*/, format: /(html|diff)/ }
get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => 'html', :constraints => {:path => /.*/} get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => 'html', :constraints => {:path => /.*/}

View File

@@ -56,7 +56,7 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457' should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457'
should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html' should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html'
should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457' should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457', :format => 'html'
%w(show entry raw annotate).each do |action| %w(show entry raw annotate).each do |action|
@paths.each do |path| @paths.each do |path|
@@ -66,7 +66,7 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
end end
@paths.each do |path| @paths.each do |path|
should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{path}" => "repositories#diff", should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{path}" => "repositories#diff",
:id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => path, :format => 'html'
end end
end end
@@ -85,7 +85,7 @@ class RoutingRepositoriesTest < Redmine::RoutingTest
end end
@paths.each do |path| @paths.each do |path|
should_route "GET /projects/foo/repository/svn/diff/#{path}" => "repositories#diff", should_route "GET /projects/foo/repository/svn/diff/#{path}" => "repositories#diff",
:id => 'foo', :repository_id => 'svn', :path => path :id => 'foo', :repository_id => 'svn', :path => path, :format => 'html'
end end
end end