Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
8e61136d7f
commit
8773842801
|
@ -102,10 +102,19 @@ class MessagesController < ApplicationController
|
||||||
else
|
else
|
||||||
redirect_to board_message_url(@board, @message)
|
redirect_to board_message_url(@board, @message)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
if params[:is_board]
|
||||||
|
if @project
|
||||||
|
redirect_to project_boards_path(@project, :flag => true)
|
||||||
|
elsif @course
|
||||||
|
redirect_to course_boards_path(@course, :flag => true)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||||
render :action => 'new', :layout => layout_file
|
render :action => 'new', :layout => layout_file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
|
@ -119,8 +128,16 @@ class MessagesController < ApplicationController
|
||||||
# Reply to a topic
|
# Reply to a topic
|
||||||
def reply
|
def reply
|
||||||
if params[:reply][:content] == ""
|
if params[:reply][:content] == ""
|
||||||
|
if params[:is_board]
|
||||||
|
if @project
|
||||||
|
(redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return)
|
||||||
|
elsif @course
|
||||||
|
(redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return)
|
||||||
|
end
|
||||||
|
else
|
||||||
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
|
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
@quote = params[:quote][:quote]
|
@quote = params[:quote][:quote]
|
||||||
@reply = Message.new
|
@reply = Message.new
|
||||||
@reply.author = User.current
|
@reply.author = User.current
|
||||||
|
@ -155,11 +172,20 @@ class MessagesController < ApplicationController
|
||||||
# Edit a message
|
# Edit a message
|
||||||
def edit
|
def edit
|
||||||
@isReply = false
|
@isReply = false
|
||||||
|
if params[:is_board]
|
||||||
|
if @project
|
||||||
|
(redirect_to project_boards_path(@project); return false)
|
||||||
|
elsif @course
|
||||||
|
(redirect_to course_boards_path(@course); return false)
|
||||||
|
end
|
||||||
|
else
|
||||||
if @project
|
if @project
|
||||||
(render_403; return false) unless @message.editable_by?(User.current)
|
(render_403; return false) unless @message.editable_by?(User.current)
|
||||||
else
|
else
|
||||||
(render_403; return false) unless @message.course_editable_by?(User.current)
|
(render_403; return false) unless @message.course_editable_by?(User.current)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@message.safe_attributes = params[:message]
|
@message.safe_attributes = params[:message]
|
||||||
if request.post? && @message.save
|
if request.post? && @message.save
|
||||||
attachments = Attachment.attach_files(@message, params[:attachments])
|
attachments = Attachment.attach_files(@message, params[:attachments])
|
||||||
|
|
Loading…
Reference in New Issue