Use named routes in controllers.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10981 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-12-11 17:51:30 +00:00
parent cf66561b1e
commit 0b96094680
13 changed files with 370 additions and 39 deletions

View File

@@ -58,7 +58,7 @@ class DocumentsController < ApplicationController
if @document.save
render_attachment_warning_if_needed(@document)
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'index', :project_id => @project
redirect_to project_documents_path(@project)
else
render :action => 'new'
end
@@ -71,7 +71,7 @@ class DocumentsController < ApplicationController
@document.safe_attributes = params[:document]
if request.put? and @document.save
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @document
redirect_to document_path(@document)
else
render :action => 'edit'
end
@@ -79,7 +79,7 @@ class DocumentsController < ApplicationController
def destroy
@document.destroy if request.delete?
redirect_to :controller => 'documents', :action => 'index', :project_id => @project
redirect_to project_documents_path(@project)
end
def add_attachment
@@ -89,6 +89,6 @@ class DocumentsController < ApplicationController
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
Mailer.attachments_added(attachments[:files]).deliver
end
redirect_to :action => 'show', :id => @document
redirect_to document_path(@document)
end
end