From 84ff3450d2724e4f42afb65142efd5e07a539ee2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 1 Sep 2015 10:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=8A=A8=E6=80=81=E4=B8=AD=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E9=80=9A=E7=9F=A5=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/comments_controller.rb | 13 +- app/views/comments/create.js.erb | 3 + app/views/users/_course_news.html.erb | 25 +++- app/views/users/_user_activities.html.erb | 9 +- app/views/users/user_newfeedback.html.erb | 27 +--- public/javascripts/init_KindEditor.js | 100 +++++++++++++ public/javascripts/user.js | 175 ---------------------- public/stylesheets/new_user.css | 16 +- 8 files changed, 156 insertions(+), 212 deletions(-) create mode 100644 app/views/comments/create.js.erb create mode 100644 public/javascripts/init_KindEditor.js diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c10f8bc84..ac25fbe9d 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -34,7 +34,7 @@ class CommentsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT end - # 与我相关动态的记录add start + # 锟斤拷锟斤拷锟斤拷囟锟教拷募锟铰糰dd start if( @comment.id && @news.course ) if(@news.author_id != User.current.id) notify = ActivityNotify.new() @@ -47,11 +47,18 @@ class CommentsController < ApplicationController notify.save() end end - # 与我相关动态的记录add end + # 锟斤拷锟斤拷锟斤拷囟锟教拷募锟铰糰dd end flash[:notice] = l(:label_comment_added) end - redirect_to news_url(@news) + if params[:user_activity_id] + @user_activity_id = params[:user_activity_id] + respond_to do |format| + format.js + end + else + redirect_to news_url(@news) + end end def destroy diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb new file mode 100644 index 000000000..d55b714ad --- /dev/null +++ b/app/views/comments/create.js.erb @@ -0,0 +1,3 @@ +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + +init_KindEditor_data(<%= @user_activity_id%>); diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 4295139e0..fb9561df6 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -1,4 +1,4 @@ -
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "鐢ㄦ埛澶村儚" %> @@ -18,9 +18,9 @@
鍙戝竷鏃堕棿锛<%= format_date(activity.created_on) %>
-
閫氱煡鎻忚堪锛<%= activity.description.html_safe %>
+
閫氱煡鎻忚堪锛<%= activity.description.html_safe %>
-