文章的二级回复和组织帖子的二级回复
This commit is contained in:
parent
e19efc1c8a
commit
b77779ca55
|
@ -123,10 +123,14 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
def destroy
|
||||
@org_document_comment = OrgDocumentComment.find(params[:id])
|
||||
@org_sub_id = @org_document_comment.org_subfield_id
|
||||
org = @org_document_comment.organization
|
||||
org = @org_document_comment.root.organization
|
||||
if @org_document_comment.id == org.home_id
|
||||
org.update_attributes(:home_id => nil)
|
||||
end
|
||||
if params[:user_activity_id]
|
||||
@act = OrgActivity.find(params[:user_activity_id])
|
||||
@document = @org_document_comment.root
|
||||
end
|
||||
if @org_document_comment.destroy
|
||||
end
|
||||
respond_to do |format|
|
||||
|
@ -145,48 +149,26 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
end
|
||||
def quote
|
||||
@org_comment = OrgDocumentComment.find(params[:id])
|
||||
@subject = @org_comment.content
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}\n> "
|
||||
@temp = OrgDocumentComment.new
|
||||
#@course_id = params[:course_id]
|
||||
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)} <br/>#{@org_comment.content.html_safe}</blockquote>".html_safe
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@quote = params[:quote][:quote]
|
||||
@document = OrgDocumentComment.find(params[:id])
|
||||
@org_document = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:id])
|
||||
|
||||
# params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
|
||||
# params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
|
||||
@org_document.title = params[:org_document_comment][:title]
|
||||
@org_document.content = params[:org_document_comment][:content]
|
||||
@org_document.content = @quote + @org_document.content
|
||||
#@org_document.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
|
||||
@document.children << @org_document
|
||||
# @user_activity_id = params[:user_activity_id]
|
||||
# user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
|
||||
# if user_activity
|
||||
# user_activity.updated_at = Time.now
|
||||
# user_activity.save
|
||||
# end
|
||||
# attachments = Attachment.attach_files(@org_document, params[:attachments])
|
||||
# render_attachment_warning_if_needed(@org_document)
|
||||
#@article.save
|
||||
# redirect_to user_blogs_path(:user_id=>params[:user_id])
|
||||
@document = @document.root
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@act = OrgActivity.find(@user_activity_id) if @user_activity_id
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
||||
# redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||
# else
|
||||
redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)
|
||||
# end
|
||||
|
||||
}
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -128,6 +128,11 @@ class UsersController < ApplicationController
|
|||
@activity_id = params[:activity_id]
|
||||
@homepage = params[:homepage]
|
||||
@type = 'BlogComment'
|
||||
when 'OrgDocumentComment'
|
||||
@reply = OrgDocumentComment.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'OrgDocumentComment'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -3286,7 +3291,10 @@ class UsersController < ApplicationController
|
|||
case params[:type]
|
||||
when 'OrgDocumentComment'
|
||||
obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.children.reorder("created_at desc")
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@type = 'OrgDocumentComment'
|
||||
comments = []
|
||||
@journals = get_all_children(comments, obj)
|
||||
when 'Message'
|
||||
obj = Message.where('id = ?', params[:id].to_i).first
|
||||
@type = 'Message'
|
||||
|
@ -3315,6 +3323,7 @@ class UsersController < ApplicationController
|
|||
obj = BlogComment.where('id = ?', params[:id].to_i).first
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@homepage = params[:homepage].to_i
|
||||
@type = 'BlogComment'
|
||||
comments = []
|
||||
@journals = get_all_children(comments, obj)
|
||||
when 'HomeworkCommon'
|
||||
|
|
|
@ -3141,13 +3141,18 @@ end
|
|||
|
||||
#获取所有子节点
|
||||
def get_all_children result, jour
|
||||
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) || (jour.kind_of? BlogComment)
|
||||
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) || (jour.kind_of? BlogComment) || (jour.kind_of? OrgDocumentComment)
|
||||
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 }
|
||||
if jour.respond_to?(:created_on)
|
||||
result.sort! { |a,b| b.created_on <=> a.created_on }
|
||||
elsif jour.respond_to?(:created_at)
|
||||
result.sort! { |a,b| b.created_at <=> a.created_at }
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
#将有置顶属性的提到数组前面
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(function () {
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$("#Container").css("width", "1000px");
|
||||
$(".postRightContainer").css("margin-left", "0px");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
function expand_reply(container, btnid) {
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
if (btn.data('init') == '0') {
|
||||
btn.data('init', 1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
} else {
|
||||
btn.data('init', 0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
|
@ -28,15 +28,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
function course_board_canel_message_replay()
|
||||
{
|
||||
function course_board_canel_message_replay() {
|
||||
message_content_editor.html("");
|
||||
}
|
||||
|
||||
function course_board_submit_message_replay()
|
||||
{
|
||||
if(MessageReplayVevify())
|
||||
{
|
||||
function course_board_submit_message_replay() {
|
||||
if (MessageReplayVevify()) {
|
||||
message_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
||||
$("#message_form").submit();
|
||||
|
||||
|
@ -57,20 +54,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(function () {
|
||||
//init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @topic.id%>, null, "100%", "<%=@topic.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @topic.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
|
||||
<%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50, :alt => '图像'), user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if User.current.logged? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id %>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
@ -90,29 +87,29 @@
|
|||
:class => 'postOptionLink'
|
||||
) if @message.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');",:class => 'postOptionLink'%></li>
|
||||
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => 'postOptionLink' %></li>
|
||||
<!--<li> <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<div class="postDetailTitle fl">
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject %></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<%= link_to @topic.author.show_name, user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<%= link_to @topic.author.show_name, user_path(@topic.author, :host => Setting.host_user), :class => "linkBlue2", :target => "_blank" %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
|
||||
<div class="postDetailDate mb5"><%= format_time(@topic.created_on) %></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @topic.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @topic.content.html_safe%>
|
||||
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @topic.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;">
|
||||
<%= @topic.content.html_safe %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
|
||||
<%= render :partial => "attachments/activity_attach", :locals => {:activity => @topic} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -121,49 +118,69 @@
|
|||
<div class="homepagePostReply">
|
||||
<% unless @replies.empty? %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %>)</div>
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= @reply_count>0 ? "(#{@reply_count})" : "" %></sapn>
|
||||
<span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%= @topic.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => @topic, :user_activity_id => @topic.id, :type => "activity"} %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @topic.id %>">
|
||||
<% @replies.each_with_index do |reply,i| %>
|
||||
<% all_comments = [] %>
|
||||
<% comments = get_all_children(all_comments, @topic) %>
|
||||
<div class="" id="reply_div_<%= @topic.id %>">
|
||||
<% comments.each_with_index do |reply, i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(function () {
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33, :height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
|
||||
<%= time_from_now(reply.created_on) %>
|
||||
</div>
|
||||
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply} %>
|
||||
<% end %>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
<%= reply.content.html_safe %>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :post,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.org_subfield_editable_by?(User.current) %>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= reply.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :post,
|
||||
:class => 'fr mr20',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.course_destroyable_by?(User.current) %>
|
||||
</span>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
<p id="reply_message_<%= reply.id %>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -175,6 +192,7 @@
|
|||
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
|
@ -189,13 +207,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#message_description_<%= @topic.id %> p,#message_description_<%= @topic.id %> span,#message_description_<%= @topic.id %> em").each(function(){
|
||||
$(function () {
|
||||
$("#message_description_<%= @topic.id %> p,#message_description_<%= @topic.id %> span,#message_description_<%= @topic.id %> em").each(function () {
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent = postContent.replace(/ /g, " ");
|
||||
postContent = postContent.replace(/ {2}/g, " ");
|
||||
postContent = postContent.replace(/ /g, " ");
|
||||
postContent = postContent.replace(/ /g, " ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
autoUrl('message_description_<%= @topic.id %>');
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="org_document_comment[title]" id="reply_subject">
|
||||
<input type="hidden" name="org_document_comment[title]" value="RE:<%=(OrgDocumentComment.find @org_comment).root.title %>" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></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:2px;">发送</a>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
//location.reload();
|
||||
<% if params[:detail_page] %>
|
||||
<% if @act %>
|
||||
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => 2, :act => @act}) %>");
|
||||
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");
|
||||
<% elsif params[:detail_page] %>
|
||||
window.location.href = '<%= organization_path(params[:organization_id],:org_subfield_id => @org_sub_id )%>';
|
||||
<% else %>
|
||||
window.location.reload();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
if($("#reply_message_<%= @org_comment.id%>").length > 0) {
|
||||
$("#reply_message_<%= @org_comment.id%>").replaceWith("<%= escape_javascript(render :partial => 'org_document_comments/simple_ke_reply_form', :locals => {:reply => @org_comment,:temp =>@temp,:subject =>@subject}) %>");
|
||||
$(function(){
|
||||
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
|
||||
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
sd_create_editor_from_data(<%= @org_comment.id%>,null,"100%", "<%=@org_comment.class.to_s%>");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @org_comment.id %>").length >0) {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
//location.reload();
|
||||
<% if @user_activity_id %>
|
||||
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => 2, :act => @act}) %>");
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");
|
||||
|
|
|
@ -74,8 +74,8 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
||||
<% count = @document.children.count() %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, @document).count %>
|
||||
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
||||
<%# if count > 0 %>
|
||||
|
@ -87,52 +87,68 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% all_comments = []%>
|
||||
<% comments = get_all_children(all_comments, @document) %>
|
||||
<div class="" id="reply_div_<%= @document.id %>">
|
||||
<% comments_for_doc.each_with_index do |reply,i| %>
|
||||
<% comments.each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
autoUrl('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% user = User.find(reply.creator_id) %>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id %>').hide();">
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_url_in_org(user.id) %>
|
||||
<%= 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">
|
||||
<%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "newsBlue mr10 f14" %>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe unless reply.content.nil? %>
|
||||
<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_at) %>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_at) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
||||
<% end %>
|
||||
<% if !comment.content_detail.blank? %>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.content_detail.html_safe %>
|
||||
</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>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'org_document_comments',:action => 'quote',:user_id=>reply.creator_id, :id => reply.id},
|
||||
{:controller => 'org_document_comments',:action => 'quote',:user_id=>comment.creator_id, :id => comment.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue mr10',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
:title => l(:button_reply)) %>
|
||||
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<% if comment.creator_user == User.current %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'org_document_comments',:action => 'delete_reply', :id => reply.id},
|
||||
{:controller => 'org_document_comments',:action => 'delete_reply', :id => comment.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:class => 'fr mr20',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.creator_id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id %>"></p>
|
||||
: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>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%# end %>
|
||||
|
|
|
@ -69,20 +69,16 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = 0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
|
||||
<%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
|
||||
|
||||
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
|
||||
<% 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/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => 0, :is_board =>0}%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -67,15 +67,20 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% comments_for_doc = document.children.reorder("created_at desc").limit(3) %>
|
||||
<% count = document.children.count() %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, document).count %>
|
||||
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => document, :user_activity_id => document.id} %>
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => document, :user_activity_id => act.id} %>
|
||||
|
||||
<% all_comments = []%>
|
||||
<% comments = get_all_children(all_comments, document)[0..2] %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= act.id %>">
|
||||
<%= render :partial => 'users/org_document_replies', :locals => {:comments => comments, :user_activity_id => act.id, :type => 'OrgDocumentComment', :activity_id =>document.id}%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer" id="reply_div_<%= document.id %>" style="display:<%= count == 0 ? 'none' : 'block' %>">
|
||||
<%= render :partial => 'users/all_replies', :locals => {:comments => comments_for_doc}%>
|
||||
</div>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= act.id %>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
|
||||
|
@ -84,7 +89,6 @@
|
|||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= act.id %>' style="display:none;">
|
||||
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="org_activity_id" value="<%= act.id %>"/>
|
||||
<div nhname='toolbar_container_<%= act.id %>'></div>
|
||||
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= act.id %>' name="org_content"></textarea>
|
||||
<a id="new_message_submit_btn_<%= act.id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;line-height:18px;">发送</a>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
</div>
|
||||
<div class="orig_right fl">
|
||||
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %>
|
||||
<span class="orig_area"><%= time_from_now(comment.created_on) %></span>
|
||||
<span class="orig_area"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
|
||||
<div class="orig_content "><%= comment.content_detail.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -80,8 +80,6 @@
|
|||
</div>
|
||||
<% 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/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<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_at) %>
|
||||
</div>
|
||||
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
||||
<% end %>
|
||||
<% if !comment.content_detail.blank? %>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.content_detail.html_safe %>
|
||||
</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 comment.creator_user == User.current %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'org_document_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id},
|
||||
:method => :delete,
|
||||
:remote => true,
|
||||
:class => 'fr mr20',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
: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>
|
|
@ -43,8 +43,6 @@
|
|||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
<% elsif @type == 'BlogComment' %>
|
||||
<%#= form_for reply, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
|
||||
<%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => User.current.id}, :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%=(BlogComment.find @activity_id).title %>" id="reply_subject">
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
|
||||
|
@ -57,7 +55,17 @@
|
|||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<% elsif @type == 'OrgDocumentComment' %>
|
||||
<%= form_for('new_form', :url => {:controller => 'org_document_comments',:action => 'reply', :id => reply.id}, :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="org_document_comment[title]" value="RE:<%=(OrgDocumentComment.find @activity_id).title %>" id="reply_subject">
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></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:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -6,6 +6,8 @@ $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :part
|
|||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>');
|
||||
<% elsif params[:type] == 'BlogComment' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/blog_comments_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>');
|
||||
<% elsif params[:type] == 'OrgDocumentComment' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/org_document_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :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}) %>');
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue