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
redirect_to board_message_url(@board, @message)
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@ -131,24 +123,17 @@ class MessagesController < ApplicationController
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
end
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
render_attachment_warning_if_needed(@reply)
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)
#render file: 'messages#show', layout: 'base_courses'
end
redirect_to board_message_url(@board, @topic, :r => @reply)
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
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
elsif request.get?
respond_to do |format|
format.html {
@ -195,20 +172,16 @@ 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)
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to course_board_url(@course, @board)
end
redirect_to course_board_url(@course, @board)
end
end
end
@ -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'},