This commit is contained in:
sw 2015-05-08 15:44:03 +08:00
commit 821ceb41cf
2 changed files with 15 additions and 42 deletions

View File

@ -93,15 +93,7 @@ class MessagesController < ApplicationController
end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @message)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@ -140,15 +132,8 @@ class MessagesController < ApplicationController
else
#render file: 'messages#show', layout: 'base_courses'
end
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @topic, :r => @reply)
end
end
# Edit a message
@ -165,15 +150,7 @@ class MessagesController < ApplicationController
render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update)
@message.reload
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
end
elsif request.get?
respond_to do |format|
format.html {
@ -195,15 +172,12 @@ class MessagesController < ApplicationController
@message.destroy
# modify by nwb
if @project
if params[:is_board]
redirect_to project_boards_url(@project)
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to board_message_url(@board, @topic, :r => @reply)
redirect_to project_boards_url(@project)
end
elsif @course
if params[:is_board]
redirect_to course_boards_url(@course)
else
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
@ -211,7 +185,6 @@ class MessagesController < ApplicationController
end
end
end
end
def quote
@subject = @message.subject
@ -229,7 +202,7 @@ class MessagesController < ApplicationController
render :partial => 'common/preview'
end
private
private
def find_message
return unless find_board
@message = @board.messages.find(params[:id], :include => :parent)

View File

@ -5,7 +5,7 @@
<% if @message.project %>
<%#= board_breadcrumb(@message) %>
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
<div class="talk_new ml15">
<div class="ml15">
<ul>
<%= form_for @message, { :as => :message,
:url => {:action => 'edit'},