From 5f203ec8c0e297666cc24591f2748c002b00bfa2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 16:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AE=BA=E5=9D=9B=E6=88=96?= =?UTF-8?q?=E8=80=85=E5=9B=9E=E5=A4=8D,=E5=A6=82=E6=9E=9C=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E4=BA=86=EF=BC=8C=E8=A6=81=E6=9B=B4=E6=96=B0=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=9A=84owner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/forums_controller.rb | 12 +++++++++++- app/controllers/memos_controller.rb | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 64157ea42..c347ba6b8 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -1,7 +1,7 @@ # added by fq class ForumsController < ApplicationController layout "users_base" - + include ApplicationHelper # GET /forums # GET /forums.json before_filter :find_forum_if_available @@ -63,6 +63,9 @@ class ForumsController < ApplicationController respond_to do |format| if @memo.save + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids ,@memo.id,1 + #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 } else @@ -163,6 +166,13 @@ class ForumsController < ApplicationController @forum = Forum.new(params[:forum]) @forum.creator_id = User.current.id if @forum.save + # Time 2015-03-24 17:07:05 + # Author lizanle + # Description after save后需要进行资源记录的更新 + # owner_type = 2 对应的是 forum + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids ,@forum.id,2 + #end respond_to do |format| format.html { redirect_to @forum, notice: l(:label_forum_create_succ) } diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index aaa99e417..54bcc0496 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -59,6 +59,20 @@ class MemosController < ApplicationController @memo.content = @quote + @memo.content respond_to do |format| if @memo.save + # Time 2015-03-24 14:47:05 + # Author lizanle + # Description after save后需要进行资源记录的更新 + # owner_type = 1 对应的是 memo + if !params[:asset_id].nil? + ids = params[:asset_id].split(',') + ids.each do |id| + asset = Kindeditor::Asset.find(id.to_i) + asset.owner_id = @memo.id + asset.owner_type = 1 + asset.save + end + end + #end format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo } else