More use of shortcut routes

This commit is contained in:
Dmitriy Zaporozhets 2015-02-25 19:50:01 -08:00
parent 0a4dec24c8
commit 128012dba8
4 changed files with 6 additions and 10 deletions

View file

@ -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
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
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

View file

@ -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

View file

@ -1,7 +1,7 @@
%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

View file

@ -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.