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/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 0995d1304..9f4b5f171 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -20,11 +20,11 @@ class IssuesController < ApplicationController default_search_scope :issues before_filter :authorize1, :only => [:show] - before_filter :find_issue, :only => [:show, :edit, :update] + before_filter :find_issue, :only => [:show, :edit, :update,:add_journal] before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] before_filter :find_project, :only => [:new, :create, :update_form] #before_filter :authorize, :except => [:index, :show] - before_filter :authorize, :except => [:index] + before_filter :authorize, :except => [:index,:add_journal] before_filter :find_optional_project, :only => [:index] before_filter :check_for_default_issue_status, :only => [:new, :create] @@ -383,6 +383,18 @@ class IssuesController < ApplicationController end end + def add_journal + jour = Journal.new + jour.user_id = User.current.id + jour.notes = params[:notes] + jour.journalized = @issue + jour.save + @user_activity_id = params[:user_activity_id] + respond_to do |format| + format.js + end + end + private def find_project 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/controllers/users_controller.rb b/app/controllers/users_controller.rb index 696b9f7da..6671f122b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -720,9 +720,7 @@ class UsersController < ApplicationController end def show - @page = params[:page] ? params[:page].to_i + 1 : 0 - user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" course_types = "('Message','News','HomeworkCommon','poll')" 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/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb new file mode 100644 index 000000000..efa5750c2 --- /dev/null +++ b/app/views/issues/add_journal.js.erb @@ -0,0 +1,3 @@ +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); + +init_KindEditor_data(<%= @user_activity_id%>); \ No newline at end of file diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb new file mode 100644 index 000000000..9d3d68855 --- /dev/null +++ b/app/views/messages/reply.js.erb @@ -0,0 +1,6 @@ +<%if @project%> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); +<%elsif @course%> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); +<%end%> +init_KindEditor_data(<%= @user_activity_id%>); \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f411aa98e..2bbafb4df 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -21,17 +21,10 @@
鎴鏃堕棿锛<%= format_date(activity.end_time) %>
-
+
浣滀笟鎻忚堪锛<%= activity.description.html_safe %>
- -