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 %>
-
-
+
-
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index deaff2207..f27d6cae5 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -1,5 +1,5 @@
-
-
+
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "鐢ㄦ埛澶村儚" %>
@@ -12,7 +12,6 @@
<% end %>
TO
<%= link_to activity.course.name.to_s+" | 璇剧▼璁ㄨ鍖", course_boards_path(activity.course), :class => "newsBlue ml15 mr5"%>
- <%#= link_to activity.course.name.to_s+"(璇剧▼璁ㄨ鍖)", course_path(activity.course), :class => "newsBlue ml15 mr5"%>
<% if activity.parent_id.nil? %>
@@ -26,14 +25,14 @@
-
甯栧瓙鎻忚堪锛
+
甯栧瓙鎻忚堪锛
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>
<%= activity.parent.content.to_s.html_safe%>
<% end %>
-
+
<%#=format_date(activity.updated_on)%>
<%if count>2 %>
-
+
<% end %>
-
-
-
+
+
<% activity= activity.parent_id.nil? ? activity:activity.parent%>
<% replies_all_i = 0 %>
<% unless activity.children.empty? %>
-
+
<% activity.children.reorder("created_on desc").each do |reply|%>
<% replies_all_i=replies_all_i+1 %>
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb
index 4abe9c82c..442ad5e59 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 %>
-
+
-
@@ -40,30 +40,27 @@
鍥炲锛<%= count %>锛
<%#= format_date(activity.updated_on) %>
<%if count>2 %>
-
+
<% end %>
-
- <%#= render :partial => 'course_news_reply',:locals => { :contest => @contest, :journals => @jour, :state => false}%>
-
<% replies_all_i = 0 %>
<% unless activity.comments.empty? %>
-
+
<% activity.comments.reorder("created_on desc").each do |comment| %>
<% replies_all_i=replies_all_i+1 %>
@@ -79,9 +76,6 @@
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_date(comment.created_on) %>
- <%#= link_to_if_authorized_course l(:button_delete), {:controller => 'comments', :action => 'destroy', :id => activity, :comment_id => comment},
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
-
<%= comment.comments.html_safe %>
diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb
index a6f21a97f..15e549ad8 100644
--- a/app/views/users/_course_poll.html.erb
+++ b/app/views/users/_course_poll.html.erb
@@ -28,8 +28,8 @@
鍙戝竷鏃堕棿锛<%= format_date(activity.published_at) %>
-
闂嵎鎻忚堪锛<%=activity.polls_description.html_safe.to_s%>
-
+
闂嵎鎻忚堪锛<%=activity.polls_description.html_safe.to_s%>
+
-
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb
index f628c63d2..f23bdb74c 100644
--- a/app/views/users/_project_issue.html.erb
+++ b/app/views/users/_project_issue.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 => "鐢ㄦ埛澶村儚" %>
@@ -28,7 +28,7 @@
鏃堕棿锛<%=format_date(activity.created_on) %>
-
缂洪櫡鎻忚堪锛
+
缂洪櫡鎻忚堪锛
<% if activity.description? %>
<%= textAreailizable activity, :description, :attachments => activity.attachments %>
<% end %>
@@ -55,13 +55,7 @@
<% end %>
<% end %>
-
-
+
-
@@ -83,24 +77,28 @@
<%#= format_date(activity.updated_on) %>
<% if count>2 %>
<% end %>
-
-
-
+
+
<% replies_all_i = 0 %>
<% unless activity.journals.empty? %>
-
+
<% activity.journals.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i+1 %>
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb
index 3164ad798..286a272c4 100644
--- a/app/views/users/_project_message.html.erb
+++ b/app/views/users/_project_message.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 => "鐢ㄦ埛澶村儚" %>
@@ -26,14 +26,14 @@
鏃堕棿锛<%= format_date(activity.created_on) %>
-
甯栧瓙鎻忚堪锛
+
甯栧瓙鎻忚堪锛
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>
<%= activity.parent.content.to_s.html_safe%>
<% end %>
-
+
<%#=format_date(activity.updated_on)%>
<%if count>2 %>
-
+
<% end %>
-
-
-
+
+
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
<% replies_all_i = 0 %>
<% unless activity.children.empty? %>
-
+
<% activity.children.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i+1 %>
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb
index b43d0d54e..a5325342c 100644
--- a/app/views/users/_user_activities.html.erb
+++ b/app/views/users/_user_activities.html.erb
@@ -1,51 +1,20 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
+
<% user_activities.each do |user_activity|
- unless user_activities.nil? %>
+ if user_activities %>
<% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>
<% case user_activity.container_type.to_s %>
@@ -65,38 +38,22 @@
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %>
- <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %>
+ <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'News' %>
- <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %>
+ <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'Message'%>
- <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'Course'%>
- <%#= render :partial => 'course_create', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'Attachment' %>
- <%#= render :partial => 'course_attachment', :locals => {:activity => act, :user_activity => user_activity} %>
- <%# when 'JournalsForMessage' %>
- <%#= render :partial => 'course_journalsformessage', :locals => {:activity => act, :user_activity => user_activity} %>
+ <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'Poll' %>
- <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %>
+ <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% end %>
<% end %>
<% when 'Project' %>
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'Issue' %>
- <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity =>user_activity} %>
+ <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'Message' %>
- <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'Journal' %>
- <%#= render :partial => 'project_journal', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'News' %>
- <%#= render :partial => 'project_news', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'Document' %>
- <%#= render :partial => 'project_document', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'Attachment' %>
- <%#= render :partial => 'project_attachment', :locals => {:activity => act,:user_activity =>user_activity} %>
- <%# when 'ProjectCreateInfo' %>
- <%#= render :partial => 'project_create', :locals => {:activity => act,:user_activity =>user_activity} %>
+ <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
<% end %>
<% end %>
diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb
index 556069a1f..e331b49e7 100644
--- a/app/views/users/user_newfeedback.html.erb
+++ b/app/views/users/user_newfeedback.html.erb
@@ -1,11 +1,6 @@
-
-
-
-
-
-
-
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor","user" %>
-<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %>
-
-
-
-