Commit 128012db authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

More use of shortcut routes

parent 0a4dec24
...@@ -60,8 +60,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -60,8 +60,7 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
if @issue.valid? if @issue.valid?
redirect_to namespace_project_issue_path(@project.namespace, redirect_to issue_path(@issue)
@project, @issue)
else else
render :new render :new
end end
...@@ -79,7 +78,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -79,7 +78,7 @@ class Projects::IssuesController < Projects::ApplicationController
format.js format.js
format.html do format.html do
if @issue.valid? if @issue.valid?
redirect_to [@project.namespace.becomes(Namespace), @project, @issue] redirect_to issue_path(@issue)
else else
render :edit render :edit
end end
...@@ -129,8 +128,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -129,8 +128,7 @@ class Projects::IssuesController < Projects::ApplicationController
issue = @project.issues.find_by(id: params[:id]) issue = @project.issues.find_by(id: params[:id])
if issue if issue
redirect_to namespace_project_issue_path(@project.namespace, @project, redirect_to issue_path(issue)
issue)
return return
else else
raise ActiveRecord::RecordNotFound.new raise ActiveRecord::RecordNotFound.new
......
...@@ -79,9 +79,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -79,9 +79,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if @merge_request.valid? if @merge_request.valid?
redirect_to( redirect_to(
namespace_project_merge_request_path(@merge_request.target_project.namespace, merge_request_path(@merge_request)
@merge_request.target_project,
@merge_request),
notice: 'Merge request was successfully created.' notice: 'Merge request was successfully created.'
) )
else else
......
%li{ class: mr_css_classes(merge_request) } %li{ class: mr_css_classes(merge_request) }
.merge-request-title .merge-request-title
%span.str-truncated %span.str-truncated
= link_to_gfm merge_request.title, namespace_project_merge_request_path(merge_request.target_project.namespace, merge_request.target_project, merge_request), class: "row_title" = link_to_gfm merge_request.title, merge_request_path(merge_request), class: "row_title"
.pull-right.light .pull-right.light
- if merge_request.merged? - if merge_request.merged?
%span %span
......
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
Changes view for this comparison is extremely large. Changes view for this comparison is extremely large.
%p %p
You can You can
= link_to "download it", namespace_project_merge_request_path(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request, format: :diff), class: "vlink" = link_to "download it", merge_request_path(@merge_request, format: :diff), class: "vlink"
instead. instead.
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