Use named routes.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10003 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-07-15 19:14:23 +00:00
parent 54d2b07bff
commit 471f631dbd
2 changed files with 9 additions and 7 deletions

View File

@ -59,7 +59,7 @@ class MessagesController < ApplicationController
if @message.save if @message.save
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message) render_attachment_warning_if_needed(@message)
redirect_to :action => 'show', :id => @message redirect_to board_message_path(@board, @message)
end end
end end
end end
@ -76,7 +76,7 @@ class MessagesController < ApplicationController
attachments = Attachment.attach_files(@reply, params[:attachments]) attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply) render_attachment_warning_if_needed(@reply)
end end
redirect_to :action => 'show', :id => @topic, :r => @reply redirect_to board_message_path(@board, @topic, :r => @reply)
end end
# Edit a message # Edit a message
@ -88,7 +88,7 @@ class MessagesController < ApplicationController
render_attachment_warning_if_needed(@message) render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
@message.reload @message.reload
redirect_to :action => 'show', :board_id => @message.board, :id => @message.root, :r => (@message.parent_id && @message.id) redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id))
end end
end end
@ -97,9 +97,11 @@ class MessagesController < ApplicationController
(render_403; return false) unless @message.destroyable_by?(User.current) (render_403; return false) unless @message.destroyable_by?(User.current)
r = @message.to_param r = @message.to_param
@message.destroy @message.destroy
redirect_to @message.parent.nil? ? if @message.parent
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } : redirect_to board_message_path(@board, @message.parent, :r => r)
{ :action => 'show', :id => @message.parent, :r => r } else
redirect_to project_board_path(@project, @board)
end
end end
def quote def quote

View File

@ -33,7 +33,7 @@ RedmineApp::Application.routes.draw do
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post]
get 'boards/:board_id/topics/:id', :to => 'messages#show' get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'