Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ad0a5012
Commit
ad0a5012
authored
May 18, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a single route, reducing duplication
parent
b8ff4b26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
config/routes/project.rb
config/routes/project.rb
+16
-27
No files found.
config/routes/project.rb
View file @
ad0a5012
...
@@ -198,39 +198,28 @@ constraints(ProjectUrlConstrainer.new) do
...
@@ -198,39 +198,28 @@ constraints(ProjectUrlConstrainer.new) do
end
end
end
end
# It's a block, not a hash, disabling style check for hash
redirect_builds_to_jobs
=
redirect
do
|
params
,
req
|
# rubocop:disable Style/AlignHash
args
=
params
.
values_at
(
:namespace_id
,
:project_id
,
:id
).
compact
get
'/builds/:id/:action'
,
as:
'action_legacy_build'
,
url_helpers
=
Gitlab
::
Routing
.
url_helpers
to:
redirect
{
|
params
,
req
|
args
=
params
.
values_at
(
:namespace_id
,
:project_id
,
:id
)
if
params
[
:id
]
case
params
[
:action
]
case
params
[
:action
]
when
'status'
when
'status'
Gitlab
::
Routing
.
url_helpers
.
status_namespace_project_job_path
(
*
args
,
format:
params
[
:format
])
url_helpers
.
status_namespace_project_job_path
(
*
args
,
format:
params
[
:format
])
when
'trace'
when
'trace'
Gitlab
::
Routing
.
url_helpers
.
trace_namespace_project_job_path
(
*
args
,
format:
params
[
:format
])
url_helpers
.
trace_namespace_project_job_path
(
*
args
,
format:
params
[
:format
])
when
'raw'
when
'raw'
Gitlab
::
Routing
.
url_helpers
.
raw_namespace_project_job_path
(
*
args
)
url_helpers
.
raw_namespace_project_job_path
(
*
args
)
else
else
# show
Gitlab
::
Routing
.
url_helpers
.
namespace_project_job_path
(
*
args
)
url_helpers
.
namespace_project_job_path
(
*
args
)
end
end
}
else
# index
url_helpers
.
namespace_project_jobs_path
(
*
args
)
# It's a block, not a hash, disabling style check for hash
end
# rubocop:disable Style/AlignHash
end
get
'/builds/:id'
,
as:
'legacy_build'
,
to:
redirect
{
|
params
,
req
|
get
'/builds(/:id(/:action))'
,
to:
redirect_builds_to_jobs
,
Gitlab
::
Routing
.
url_helpers
.
namespace_project_job_path
(
as:
'legacy_build'
params
[
:namespace_id
],
params
[
:project_id
],
params
[
:id
])
}
# It's a block, not a hash, disabling style check for hash
# rubocop:disable Style/AlignHash
get
'/builds'
,
as:
'legacy_builds'
,
to:
redirect
{
|
params
,
req
|
Gitlab
::
Routing
.
url_helpers
.
namespace_project_jobs_path
(
params
[
:namespace_id
],
params
[
:project_id
])
}
resources
:hooks
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
resources
:hooks
,
only:
[
:index
,
:create
,
:edit
,
:update
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
member
do
member
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment