2016-05-03 16:49:13 +08:00
|
|
|
|
<% if @organization.switch_type %>
|
2016-04-29 16:14:08 +08:00
|
|
|
|
<%= render :partial => 'sub_document_comments/show_newstyle', :locals => {:document => @document} %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<% 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>
|
2016-06-02 18:04:00 +08:00
|
|
|
|
<div class="resources" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>;" id="organization_document_<%= @document.id %>">
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<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" %>
|
2016-05-03 20:08:40 +08:00
|
|
|
|
TO <%= link_to @organization.name, organization_path(@organization), :class => "newsBlue" %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
|
|
2016-05-06 16:20:47 +08:00
|
|
|
|
<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>
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<%# if @organization.home_id == @document.id %>
|
|
|
|
|
<!--<span style="color:#269ac9;">首页</span>-->
|
|
|
|
|
<%# else %>
|
|
|
|
|
<!--<span style="color:#269ac9;">组织文章</span>-->
|
|
|
|
|
<%# end %>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
</div>
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<div class="homepagePostTitle postGrey"><%= link_to @document.title %></div>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<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">
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<%#= link_to_attachments_course @document, :author => false %>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <%# if defined?(home_id) %>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
|
|
|
|
<%# end %>-->
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<% if User.current.admin? || User.current.admin_of_org?(@organization) || User.current.id == @document.creator_id %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<div class="homepagePostSetting">
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="homepagePostSettingIcon">
|
|
|
|
|
<ul class="homepagePostSettiongText">
|
2016-05-06 14:57:36 +08:00
|
|
|
|
<!--<li>-->
|
|
|
|
|
<!--<!–<%#= 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| %>–>-->
|
|
|
|
|
<!--<!–<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>–>-->
|
|
|
|
|
<!--<!–<%# end %>–>-->
|
|
|
|
|
<!--</li>-->
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<li>
|
2016-05-06 14:57:36 +08:00
|
|
|
|
<%= 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" %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
</li>
|
|
|
|
|
<li>
|
2016-05-20 22:07:33 +08:00
|
|
|
|
<%= 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',
|
2016-04-29 14:46:40 +08:00
|
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
|
:remote => true, :class => 'postOptionLink' %>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
|
|
|
|
<% count = @document.children.count() %>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<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>
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<!--<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>-->
|
2016-04-29 14:46:40 +08:00
|
|
|
|
</div>
|
2016-05-04 09:45:02 +08:00
|
|
|
|
<% if count > 3 %>
|
|
|
|
|
<div class="homepagePostReplyBannerMore">
|
2016-05-06 16:20:39 +08:00
|
|
|
|
<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">
|
2016-05-04 09:45:02 +08:00
|
|
|
|
展开更多
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
</div>
|
2016-05-06 16:20:47 +08:00
|
|
|
|
<div class="" id="reply_div_<%= @document.id %>">
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<% comments_for_doc.each_with_index do |reply,i| %>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(function(){
|
|
|
|
|
showNormalImage('reply_message_description_<%= reply.id %>');
|
2016-05-20 15:30:25 +08:00
|
|
|
|
autoUrl('reply_message_description_<%= reply.id %>');
|
2016-04-29 14:46:40 +08:00
|
|
|
|
});
|
|
|
|
|
</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">
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<%#= link_to(
|
2016-04-29 14:46:40 +08:00
|
|
|
|
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? %>
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<%#= link_to(
|
2016-04-29 14:46:40 +08:00
|
|
|
|
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>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
</div>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<%# end %>
|
2016-06-02 18:04:00 +08:00
|
|
|
|
<%# if User.current.logged?%>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<div class="talkWrapMsg" nhname="about_talk_reply">
|
|
|
|
|
<em class="talkWrapArrow"></em>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div class="talkConIpt ml5 mb10" id="reply<%= @document.id %>">
|
2016-05-04 09:45:02 +08:00
|
|
|
|
<%= 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| %>
|
2016-05-03 20:08:40 +08:00
|
|
|
|
<%= f.kindeditor :sub_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<%= 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>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2016-06-02 18:04:00 +08:00
|
|
|
|
<%# end %>
|
2016-04-29 14:46:40 +08:00
|
|
|
|
</div>
|
2016-04-28 17:36:29 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2016-04-29 14:46:40 +08:00
|
|
|
|
<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(/ /g," ");
|
|
|
|
|
postContent= postContent.replace(/ {2}/g," ");
|
|
|
|
|
postContent=postContent.replace(/ /g," ");
|
|
|
|
|
postContent=postContent.replace(/ /g," ");
|
|
|
|
|
$(this).html(postContent);
|
|
|
|
|
});
|
2016-05-20 15:30:25 +08:00
|
|
|
|
autoUrl('intro_content_<%= @document.id %>');
|
2016-05-06 16:20:39 +08:00
|
|
|
|
var replyCount = $(".homepagePostReplyContainer").size();
|
|
|
|
|
if (replyCount >3){
|
|
|
|
|
for(var i= 3; i < replyCount+1; i++){
|
|
|
|
|
$(".homepagePostReplyContainer").eq(i).hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-04-28 17:36:29 +08:00
|
|
|
|
});
|
2016-04-29 14:46:40 +08:00
|
|
|
|
function expand_reply(container, btnid) {
|
2016-05-06 16:20:39 +08:00
|
|
|
|
var target = $(container).children(".homepagePostReplyContainer");
|
2016-04-29 14:46:40 +08:00
|
|
|
|
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();
|
|
|
|
|
}
|
2016-04-28 17:36:29 +08:00
|
|
|
|
}
|
2016-04-29 14:46:40 +08:00
|
|
|
|
</script>
|
|
|
|
|
<% end %>
|