socialforge/app/views/sub_document_comments/show.html.erb

194 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% if @organization.switch_type %>
<%= render :partial => 'sub_document_comments/show_newstyle', :locals => {:document => @document} %>
<% else %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %>
<script>
$(function() {
sd_create_editor_from_data(<%= @document.id%>,null,"100%", "<%=@document.class.to_s%>");
showNormalImage('message_description_<%= @document.id %>');
});
</script>
<div class="resources" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>;" id="organization_document_<%= @document.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo">
<%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %>
TO&nbsp;&nbsp;<%= link_to @organization.name, organization_path(@organization), :class => "newsBlue" %>
|
<span style="color:#269ac9;"><%=link_to @org_subfield.name, organization_path(@organization, :org_subfield_id => @org_subfield.id), :class => "newsBlue" %></span>
|
<span style="color:#269ac9;"><%=link_to @subdomain.name, org_subfield_sub_domain_sub_document_comments_path(:sub_domain_id => @subdomain.id, :org_subfield_id => @org_subfield.id), :class => "newsBlue" %></span>
<%# if @organization.home_id == @document.id %>
<!--<span style="color:#269ac9;">首页</span>-->
<%# else %>
<!--<span style="color:#269ac9;">组织文章</span>-->
<%# end %>
</div>
<div class="homepagePostTitle postGrey"><%= link_to @document.title %></div>
<div class="homepagePostDate">
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %></div>
<% unless @document.content.blank? %>
<div class="homepagePostIntro" style="width:640px;" id="intro_content_<%= @document.id%>">
<%= @document.content.html_safe %>
</div>
<% end %>
<div class=" fl">
<%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %>
<%#= link_to_attachments_course @document, :author => false %>
</div>
<!-- <%# if defined?(home_id) %>
<div style="float:right;">最后编辑:<%#= User.find() %></div>
<%# end %>-->
<% if User.current.admin? || User.current.admin_of_org?(@organization) || User.current.id == @document.creator_id %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<!--<li>-->
<!--&lt;!&ndash;<%#= form_for('new_form', :url => {:controller => 'sub_document_comments', :action => 'set_homepage', :id => @organization.id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %>&ndash;&gt;-->
<!--&lt;!&ndash;<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>&ndash;&gt;-->
<!--&lt;!&ndash;<%# end %>&ndash;&gt;-->
<!--</li>-->
<li>
<%= link_to "编辑文章", edit_org_subfield_sub_domain_sub_document_comment_path(@document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => @document.sub_domain.id, :flag => 1), :class => "postOptionLink" %>
</li>
<li>
<%= link_to "删除文章", org_subfield_sub_domain_sub_document_comment_path(@document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => @document.sub_domain.id, :flag => 0, :detail_page=>1), :method => 'delete',
:data => {:confirm => l(:text_are_you_sure)},
:remote => true, :class => 'postOptionLink' %>
</li>
</ul>
</li>
</ul>
</div>
<div class="cl"></div>
<% end %>
</div>
</div>
<% comments_for_doc = @document.children.reorder("created_at desc") %>
<% count = @document.children.count() %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
<%# if count > 0 %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<!--<span id="praise_count_<%#=@document.id %>">-->
<%# if @document.creator_id.to_i == User.current.id.to_i %>
<!--<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%#= get_praise_num(@document) > 0 ? "#{get_praise_num(@document)}" : "" %></span></span>-->
<%# else %>
<%#=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%>
<%# end %>
<!--</span>-->
</div>
<% if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%= @document.id %>" onclick="expand_reply('#reply_div_<%= @document.id %>','#reply_btn_<%=@document.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
展开更多
</a>
</div>
<% end %>
</div>
<div class="" id="reply_div_<%= @document.id %>">
<% comments_for_doc.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
autoUrl('reply_message_description_<%= reply.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();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_url_in_org(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>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_at) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%#= link_to(
l(:button_reply),
{:controller => 'org_document_comments',:action => 'quote',:user_id=>reply.creator_id, :id => reply.id},
:remote => true,
:method => 'get',
:class => 'fr newsBlue mr10',
:title => l(:button_reply)) if User.current.logged? %>
<%#= link_to(
l(:button_delete),
{:controller => 'org_document_comments',:action => 'delete_reply', :id => reply.id},
:method => :delete,
:class => 'fr newsGrey mr10',
: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>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="cl"></div>
<%# end %>
<%# if User.current.logged?%>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @document.id %>">
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc', :controller => 'sub_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= f.kindeditor :sub_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "message_content_editor.sync();$('#message_form').submit();", :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %>
<% end %>
<div class="cl"></div>
</div>
</div>
<%# end %>
</div>
</div>
<script type="text/javascript">
$(function(){
$("#intro_content_<%= @document.id%> p,#intro_content_<%= @document.id%> span,#intro_content_<%= @document.id%> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$(this).html(postContent);
});
autoUrl('intro_content_<%= @document.id %>');
var replyCount = $(".homepagePostReplyContainer").size();
if (replyCount >3){
for(var i= 3; i < replyCount+1; i++){
$(".homepagePostReplyContainer").eq(i).hide();
}
}
});
function expand_reply(container, btnid) {
var target = $(container).children(".homepagePostReplyContainer");
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
</script>
<% end %>