个人留言、课程留言的二级回复

This commit is contained in:
cxt 2016-06-23 14:47:22 +08:00
parent 1b12c56960
commit 126bf9c195
19 changed files with 267 additions and 87 deletions

View File

@ -87,7 +87,10 @@ class UsersController < ApplicationController
#展开所有回复
def show_all_replies
@comment = JournalsForMessage.find params[:comment].to_i
case params[:type]
when 'JournalsForMessage'
@comment = JournalsForMessage.find params[:comment].to_i
end
end
#二级回复
@ -95,6 +98,7 @@ class UsersController < ApplicationController
case params[:type]
when 'HomeworkCommon'
@reply = JournalsForMessage.find params[:reply_id]
@type = 'HomeworkCommon'
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
else
@ -102,6 +106,11 @@ class UsersController < ApplicationController
end
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
when 'JournalsForMessage'
@reply = JournalsForMessage.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'JournalsForMessage'
end
respond_to do |format|
format.js
@ -3261,7 +3270,11 @@ class UsersController < ApplicationController
@journals = obj.comments.reorder("created_on desc")
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
@journals = obj.children.reorder("created_on desc")
journals = []
@journals = get_all_children(journals, obj)
@type = 'JournalsForMessage'
@user_activity_id = params[:div_id].to_i if params[:div_id]
@allow_delete = params[:allow_delete]
when 'Issue'
obj = Issue.where('id = ?', params[:id].to_i).first
@journals = obj.journals.reorder("created_on desc")

View File

@ -54,15 +54,16 @@ class WordsController < ApplicationController
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
@jfm = add_reply_adapter options
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
@jfm = add_reply_adapter(@activity, options)
@save_succ = true if @jfm.errors.empty?
if @save_succ
update_course_activity('JournalsForMessage',parent_id)
update_user_activity('JournalsForMessage',parent_id)
update_forge_activity('JournalsForMessage',parent_id)
update_org_activity('JournalsForMessage',parent_id)
update_principal_activity('JournalsForMessage',parent_id)
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
update_course_activity('JournalsForMessage',@activity.id)
update_user_activity('JournalsForMessage',@activity.id)
update_forge_activity('JournalsForMessage',@activity.id)
update_org_activity('JournalsForMessage',@activity.id)
update_principal_activity('JournalsForMessage',@activity.id)
@activity.update_attribute(:updated_on,Time.now)
end
respond_to do |format|
# format.html {
@ -76,8 +77,6 @@ class WordsController < ApplicationController
format.js {
#@reply_type = params[:reply_type]
@user_activity_id = params[:user_activity_id]
@activity = JournalsForMessage.find(parent_id)
@is_activity = params[:is_activity] if params[:is_activity]
}
end
@ -92,13 +91,14 @@ class WordsController < ApplicationController
elsif @journal_destroyed.jour_type == "Course"
@course = Course.find @journal_destroyed.jour_id
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
elsif @journal_destroyed.jour_type == "Principal"
@user = User.find(@journal_destroyed.jour_id)
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
@is_user = true
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_activity = params[:is_activity].to_i if params[:is_activity]
@activity = @journal_destroyed.parent if @journal_destroyed.parent
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
unless @activity
redirect_to feedback_path(@user)
return
@ -374,28 +374,44 @@ class WordsController < ApplicationController
obj
end
def add_reply_adapter options
def add_reply_adapter obj, options
#modify by nwb
#添加对课程留言的支持
#留言回复应该不关系其所属的Class而关心的是其所属的父留言
obj = obj_distinguish_url_origin || User.find_by_id(2)
if obj.kind_of? User
obj.add_jour(nil, nil, nil, options)
elsif obj.kind_of? Project
Project.add_new_jour(nil, nil, obj.id, options)
elsif obj.kind_of? Course
Course.add_new_jour(nil, nil, obj.id, options)
elsif obj.kind_of? Bid
obj.add_jour(nil, nil, nil, options)
elsif obj.kind_of? Contest
obj.add_jour(nil, nil, obj.id, options) #new added
elsif obj.kind_of? Softapplication
obj.add_jour(nil, nil, obj.id, options) #new added
elsif obj.kind_of? HomeworkAttach
obj.add_jour(nil, nil, obj.id, options) #new added
else
raise "create reply obj unknow type.#{obj.class}"
case obj.jour_type
when 'Principal'
obj.jour.add_jour(nil, nil, nil, options)
when 'Project'
Project.add_new_jour(nil, nil, obj.jour_id, options)
when 'Course'
Course.add_new_jour(nil, nil, obj.jour_id, options)
when 'Bid'
obj.jour.add_jour(nil, nil, nil, options)
when 'Contest'
obj.jour.add_jour(nil, nil, obj.jour_id, options)
when 'Softapplication'
obj.jour.add_jour(nil, nil, obj.jour_id, options)
when 'HomeworkAttach'
obj.jour.add_jour(nil, nil, obj.jour_id, options)
end
# obj = obj_distinguish_url_origin || User.find_by_id(2)
# if obj.kind_of? User
# obj.add_jour(nil, nil, nil, options)
# elsif obj.kind_of? Project
# Project.add_new_jour(nil, nil, obj.id, options)
# elsif obj.kind_of? Course
# Course.add_new_jour(nil, nil, obj.id, options)
# elsif obj.kind_of? Bid
# obj.add_jour(nil, nil, nil, options)
# elsif obj.kind_of? Contest
# obj.add_jour(nil, nil, obj.id, options) #new added
# elsif obj.kind_of? Softapplication
# obj.add_jour(nil, nil, obj.id, options) #new added
# elsif obj.kind_of? HomeworkAttach
# obj.add_jour(nil, nil, obj.id, options) #new added
# else
# raise "create reply obj unknow type.#{obj.class}"
# end
end
#######end of message
end

View File

@ -3127,6 +3127,26 @@ def get_reply_parents parents_rely, comment
parents_rely
end
#获取回复的所有父节点(不包括根节点)
def get_reply_parents_no_root parents_rely, comment
if !comment.parent.nil? && !comment.parent.parent.nil?
parents_rely << comment.parent
get_reply_parents_no_root parents_rely, comment.parent
end
parents_rely
end
#获取留言的所有子节点
def get_all_children result, jour
if jour.kind_of? JournalsForMessage
jour.children.each do |jour_child|
result << jour_child
get_all_children result, jour_child
end
end
result.sort! { |a,b| b.created_on <=> a.created_on }
end
#将有置顶属性的提到数组前面
def sort_by_sticky topics
tmpTopics = []

View File

@ -13,7 +13,7 @@
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= format_activity_day(comment.created_time) %> <%= format_time(comment.created_time, false) %>
<%= time_from_now(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>

View File

@ -1,20 +1,9 @@
<!--<span id="reply_praise_count_<%#=comment.id %>" class="orig_index">
<%# if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%#= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<%# else %>
<%#=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<%# end %>
</span>-->
<div class="orig_user fl">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
<div class="orig_right fl">
<% if comment.try(:user).try(:realname) == ' ' %>
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "content-username" %>
<% else %>
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "content-username" %>
<% end %>
<span class="orig_area"><%= time_from_now(comment.created_on) %></span>
<div class="orig_content "><%= comment.notes.html_safe %></div>
<%= link_to comment.user.show_name, user_path(comment.user_id), :class => "content-username" %>
<span class="orig_area"><%= time_from_now(comment.created_on) %></span>
<div class="orig_content "><%= comment.notes.html_safe %></div>
</div>
<div class="cl"></div>

View File

@ -38,14 +38,18 @@
</div>
<div class="cl"></div>
</div>
<% count = fetch_user_leaveWord_reply(activity).count %>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
<%# count = fetch_user_leaveWord_reply(activity).count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :allow_delete => allow_delete} %>
<% comments = activity.children.reorder("created_on desc").limit(3) %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
<%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :allow_delete => allow_delete, :activity_id =>activity.id}%>
</div>
<% end %>

View File

@ -12,11 +12,7 @@
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if comment.try(:user).try(:realname) == ' ' %>
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= link_to comment.user.show_name, user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(comment.created_on) %>
</div>
<% unless comment.m_parent_id.nil? %>
@ -37,7 +33,7 @@
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>
@ -45,7 +41,8 @@
</div>
<% end %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth t_txt" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div>
<%= comment.notes.html_safe %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">

View File

@ -0,0 +1,8 @@
<div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
</div>
<% end %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment} %>
</div>

View File

@ -0,0 +1,85 @@
<ul>
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(comment.created_on) %>
</div>
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<% parents_rely = [] %>
<% parents_rely = get_reply_parents_no_root parents_rely, comment %>
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 3 %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
</div>
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>
<% end %>
</div>
<% end %>
<% if !comment.content_detail.blank? || comment.class == Journal %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
<P><%= comment.notes.html_safe %></P>
<% else %>
<%= comment.content_detail.html_safe %>
<% end %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if allow_delete %>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>

View File

@ -0,0 +1,18 @@
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">
<span>回复</span>
<span class="reply_iconup" > ︿</span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'<%=activity.class %>',<%=user_activity_id %>,<%=allow_delete %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
</div>
<% end %>
</div>

View File

@ -1,19 +1,36 @@
<div class="orig_reply_box borderBottomNone" id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
</div>
<div class="orig_textarea mb10 fl">
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
<input type="hidden" name="is_in_course" value=<%=@is_in_course %>>
<input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>>
<input type="hidden" name="course_activity" value=<%=@course_activity %>>
<input type="hidden" name="reply[subject]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
<% if @type == 'HomeworkCommon' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
<input type="hidden" name="is_in_course" value=<%=@is_in_course %>>
<input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>>
<input type="hidden" name="course_activity" value=<%=@course_activity %>>
<input type="hidden" name="reply[subject]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
<% elsif @type == 'JournalsForMessage' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => reply.id}, :method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => reply.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => reply.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => reply.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
<%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@activity_id %>
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="user_notes"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end%>
<% end %>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>

View File

@ -86,7 +86,7 @@
<% case user_activity.act_type.to_s %>
<% when 'JournalsForMessage' %>
<% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
<% end %>
<% when 'Blog'%>

View File

@ -50,7 +50,7 @@
<ul class="homepagePostSettiongText">
<li>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
{:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id, :activity_id => activity.id},
:confirm => l(:text_are_you_sure), :method => 'delete',
:class => "postOptionLink", :title => l(:button_delete)) %>
</li>
@ -62,14 +62,17 @@
</div>
<div class="cl"></div>
</div>
<% count=fetch_user_leaveWord_reply(activity).count %>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% allow_delete = (activity.user == User.current || User.current.admin?) %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :allow_delete => allow_delete} %>
<% comments = activity.children.reorder("created_on desc").limit(3) %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
<%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :allow_delete => allow_delete, :activity_id =>activity.id}%>
</div>
<% end %>
@ -84,7 +87,6 @@
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>

View File

@ -11,7 +11,7 @@
sd_create_editor_from_data(<%= jour.id%>, null, "100%", "<%=jour.class.to_s%>");
});
</script>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>0} %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id} %>
<%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %>
<% end %>
<%end%>

View File

@ -1,5 +1,7 @@
<% if params[:type] == 'HomeworkCommon' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/homework_replies', :locals => {:comments => @journals, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>');
<% elsif params[:type] == 'JournalsForMessage' %>
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :allow_delete => @allow_delete, :activity_id =>params[:id].to_i}) %>');
<% else %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>');
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :allow_delete => @allow_delete, :activity_id =>params[:id].to_i}) %>');
<% end %>

View File

@ -1,3 +1,7 @@
<% unless @comment.parent.nil? %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>");
<% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>");
<% else %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>");
<% end %>
<% end %>

View File

@ -1,8 +1,8 @@
<% if @save_succ %>
<% if @user_activity_id %>
<% if @is_activity %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>");
<% else %>
<% if @activity.jour_type == 'Principal' %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% elsif @activity.jour_type == 'Course' %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% end %>
//init_activity_KindEditor_data('<%#= @user_activity_id%>', "", "87%", "UserActivity");

View File

@ -3,8 +3,7 @@
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
<% if @is_user%>
<% if @activity %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>");
//init_activity_KindEditor_data('<%#= @user_activity_id%>', "", "87%", "UserActivity");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
<% else %>
$("#user_activity_<%= @user_activity_id%>").hide();
@ -20,7 +19,12 @@
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
<% elsif @course && @jours_count%>
$('#course_jour_count').html("(<%= @jours_count %>)");
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
<% else %>
$('#course_jour_count').html("(<%= @jours_count %>)");
<% end %>
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>

View File

@ -1289,7 +1289,7 @@ function clear_data(k,mdu){
}
}
function expand_reply(container, btnid, id, type, div_id) {
function expand_reply(container, btnid, id, type, div_id, allow_delete) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
@ -1299,7 +1299,8 @@ function expand_reply(container, btnid, id, type, div_id) {
{
type: type,
id: id,
div_id: div_id
div_id: div_id,
allow_delete: allow_delete
},
function(data) {