]> source.dussan.org Git - redmine.git/commitdiff
Removes dynamic :action in routes.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 11 Jul 2016 17:27:32 +0000 (17:27 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 11 Jul 2016 17:27:32 +0000 (17:27 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15634 e93f8b46-1217-0410-a6f0-8f06a7374b81

config/routes.rb

index 06b500120232e54b638be276d64fb1a3fb6d7cb5..1e49a9dd53de1bfe439967f1a5d0a904e387d336 100644 (file)
@@ -246,13 +246,13 @@ Rails.application.routes.draw do
   post   'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
   delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
   get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
-  get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path)',
-      :controller => 'repositories',
-      :format => false,
-      :constraints => {
-            :action => /(browse|show|entry|raw|annotate|diff)/,
-            :rev    => /[a-z0-9\.\-_]+/
-          }
+  %w(browse show entry raw annotate diff).each do |action|
+    get "projects/:id/repository/:repository_id/revisions/:rev/#{action}(/*path)",
+        :controller => 'repositories',
+        :action => action,
+        :format => false,
+        :constraints => {:rev => /[a-z0-9\.\-_]+/}
+  end
 
   get 'projects/:id/repository/statistics', :to => 'repositories#stats'
   get 'projects/:id/repository/graph', :to => 'repositories#graph'
@@ -266,21 +266,28 @@ Rails.application.routes.draw do
   get 'projects/:id/repository/revision', :to => 'repositories#revision'
   post   'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
   delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
-  get 'projects/:id/repository/revisions/:rev/:action(/*path)',
-      :controller => 'repositories',
-      :format => false,
-      :constraints => {
-            :action => /(browse|show|entry|raw|annotate|diff)/,
-            :rev    => /[a-z0-9\.\-_]+/
-          }
-  get 'projects/:id/repository/:repository_id/:action(/*path)',
-      :controller => 'repositories',
-      :action => /(browse|show|entry|raw|changes|annotate|diff)/,
-      :format => false
-  get 'projects/:id/repository/:action(/*path)',
-      :controller => 'repositories',
-      :action => /(browse|show|entry|raw|changes|annotate|diff)/,
-      :format => false
+  %w(browse show entry raw annotate diff).each do |action|
+    get "projects/:id/repository/revisions/:rev/#{action}(/*path)",
+        :controller => 'repositories',
+        :action => action,
+        :format => false,
+        :constraints => {:rev => /[a-z0-9\.\-_]+/}
+  end
+  %w(browse entry raw changes annotate diff).each do |action|
+    get "projects/:id/repository/:repository_id/#{action}(/*path)",
+        :controller => 'repositories',
+        :action => action,
+        :format => false
+  end
+  %w(browse entry raw changes annotate diff).each do |action|
+    get "projects/:id/repository/#{action}(/*path)",
+        :controller => 'repositories',
+        :action => action,
+        :format => false
+  end
+
+  get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => false
+  get 'projects/:id/repository/show/*path', :to => 'repositories#show', :format => false
 
   get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
   get 'projects/:id/repository', :to => 'repositories#show', :path => nil