Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
db2d53aa48
|
@ -27,11 +27,13 @@ class CommentsController < ApplicationController
|
|||
raise Unauthorized unless @news.commentable?
|
||||
|
||||
@comment = Comment.new
|
||||
@comment.comments = params[:comment]
|
||||
@comment.safe_attributes = params[:comment]
|
||||
@comment.author = User.current
|
||||
if @news.comments << @comment
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
|
||||
end
|
||||
flash[:notice] = l(:label_comment_added)
|
||||
end
|
||||
|
||||
|
|
|
@ -63,8 +63,10 @@ class ForumsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @memo.save
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids ,@memo.id,OwnerTypeHelper::MEMO
|
||||
end
|
||||
#end
|
||||
format.html { redirect_to (forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
|
@ -170,8 +172,10 @@ class ForumsController < ApplicationController
|
|||
# Author lizanle
|
||||
# Description after save后需要进行资源记录的更新
|
||||
# owner_type = 2 对应的是 forum
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM
|
||||
end
|
||||
#end
|
||||
respond_to do |format|
|
||||
|
||||
|
|
|
@ -87,9 +87,10 @@ class MessagesController < ApplicationController
|
|||
@message.save_attachments(params[:attachments])
|
||||
if @message.save
|
||||
# 更新kindeditor上传的图片资源所有者
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
|
||||
|
||||
end
|
||||
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
|
||||
render_attachment_warning_if_needed(@message)
|
||||
redirect_to board_message_url(@board, @message)
|
||||
|
@ -121,8 +122,10 @@ class MessagesController < ApplicationController
|
|||
@topic.children << @reply
|
||||
#@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
|
||||
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)
|
||||
|
|
|
@ -137,8 +137,10 @@ class NewsController < ApplicationController
|
|||
@news.safe_attributes = params[:news]
|
||||
@news.save_attachments(params[:attachments])
|
||||
if @news.save
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
||||
end
|
||||
render_attachment_warning_if_needed(@news)
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to course_news_index_url(@course)
|
||||
|
|
|
@ -209,8 +209,10 @@ class WordsController < ApplicationController
|
|||
message = params[:new_form][:course_message]
|
||||
feedback = Course.add_new_jour(user, message, params[:id])
|
||||
if(feedback.errors.empty?)
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
|
||||
end
|
||||
redirect_to course_feedback_url(params[:id]), notice: l(:label_feedback_success)
|
||||
else
|
||||
flash[:error] = feedback.errors.full_messages[0]
|
||||
|
|
Loading…
Reference in New Issue