From b1de6623384f6314d07308df278e594333174f51 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 1 Sep 2015 14:18:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 36 ++++---------------- app/views/messages/reply.js.erb | 3 ++ app/views/users/_course_message.html.erb | 40 +++++++++++++---------- app/views/users/_user_activities.html.erb | 20 +++++++++--- app/views/users/user_newfeedback.html.erb | 10 ++++++ public/stylesheets/new_user.css | 27 ++++++++++----- 6 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 app/views/messages/reply.js.erb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index a242587fb..965aacab0 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -177,6 +177,7 @@ class MessagesController < ApplicationController @reply.board = @board @reply.safe_attributes = params[:reply] @reply.content = @quote + @reply.content + @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] @topic.children << @reply #@topic.update_attribute(:updated_on, Time.now) if !@reply.new_record? @@ -185,41 +186,18 @@ class MessagesController < ApplicationController update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE end - # 与我相关动态的记录add start - if(@board && @board.course) #项目的先不管 - notifyto_arr = {} - notifyto_arr[@topic.author_id] = @topic.author_id - if( params[:parent_topic] != nil && params[:parent_topic] != '') - parent_topic = Message.find(params[:parent_topic]) - notifyto_arr[parent_topic.author_id] = parent_topic.author_id - end - notifyto_arr.each do |k,user_id| - if(user_id != User.current.id) - notify = ActivityNotify.new() - if(@board.course) - notify.activity_container_id = @board.course_id - notify.activity_container_type = 'Course' - else - notify.activity_container_id = @board.project_id - notify.activity_container_type = 'Project' - end - notify.activity_id = @reply.id - notify.activity_type = 'Message' - notify.notify_to = user_id - notify.is_read = 0 - notify.save() - end - end - end - # 与我相关动态的记录add 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 params[:user_activity_id] + @user_activity_id = params[:user_activity_id] + respond_to do |format| + format.js + end + elsif params[:is_board] if @project redirect_to project_boards_path(@project) elsif @course diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb new file mode 100644 index 000000000..b1a18a8af --- /dev/null +++ b/app/views/messages/reply.js.erb @@ -0,0 +1,3 @@ +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); + +init_KindEditor_data(<%= @user_activity_id%>); \ No newline at end of file diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 0f3201e64..bd660ca7d 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,5 +1,5 @@ -