2016-06-08 11:23:16 +08:00
|
|
|
|
<% if @organization.switch_type && @document && !@document.org_subfield_id.blank? %>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<%= render :partial => 'show_custom_org_document_comment' %>
|
|
|
|
|
<% 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 <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %>
|
|
|
|
|
|
|
|
|
|
|
<% if @document.organization.home_id == @document.id %>
|
|
|
|
|
<span style="color:#269ac9;">首页</span>
|
|
|
|
|
<% else %>
|
|
|
|
|
<span style="color:#269ac9;">组织文章</span>
|
|
|
|
|
<% end %>
|
2016-06-08 11:00:19 +08:00
|
|
|
|
<% if @document.organization.home_id == @document.id %>
|
|
|
|
|
<span class="red_homework_btn_cir ml5">已设为首页</span>
|
|
|
|
|
<% end %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
</div>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<div class="homepagePostTitle postGrey"><%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %></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) %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
|
|
|
|
<%# end %>-->
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %>
|
|
|
|
|
<div class="homepagePostSetting">
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="homepagePostSettingIcon">
|
|
|
|
|
<ul class="homepagePostSettiongText">
|
|
|
|
|
<li>
|
2016-06-08 11:00:19 +08:00
|
|
|
|
<% if @document.organization.home_id == @document.id %>
|
|
|
|
|
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'cancel_homepage', :id => @document.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 %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.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 %>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete',
|
|
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
|
|
|
|
:remote => true, :class => 'postOptionLink' %>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2016-07-14 17:23:48 +08:00
|
|
|
|
<% all_comments = []%>
|
2016-10-11 14:08:44 +08:00
|
|
|
|
<% all_replies = OrgDocumentComment.where("root_id = #{@document.id}").reorder("created_at desc") %>
|
2016-09-30 14:48:42 +08:00
|
|
|
|
<% count = all_replies.count %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
|
|
|
|
<%# if count > 0 %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<div class="homepagePostReplyBanner">
|
2016-01-20 10:53:05 +08:00
|
|
|
|
<div class="homepagePostReplyBannerCount">回复
|
2016-10-08 17:50:06 +08:00
|
|
|
|
<sapn class="mr15"><%= @reply_count>0 ? "(#{@reply_count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
2016-01-20 10:53:05 +08:00
|
|
|
|
<span id="praise_count_<%=@document.id %>">
|
2016-05-25 16:19:41 +08:00
|
|
|
|
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%>
|
2016-01-20 10:53:05 +08:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
</div>
|
2016-07-14 17:23:48 +08:00
|
|
|
|
|
2016-10-08 17:50:06 +08:00
|
|
|
|
<%# comments = all_replies %>
|
|
|
|
|
<div class="" id="reply_div_<%= @document.id %>">
|
|
|
|
|
<%= render :partial => "document_show_replies" %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<%# end %>
|
|
|
|
|
<%# if User.current.logged?%>
|
2015-12-24 10:40:00 +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 %>">
|
|
|
|
|
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
|
2015-12-24 10:40:00 +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>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2016-06-07 15:40:28 +08:00
|
|
|
|
<%# end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
|
2016-06-07 15:40:28 +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);
|
|
|
|
|
});
|
|
|
|
|
autoUrl('intro_content_<%= @document.id %>');
|
2016-02-02 10:08:04 +08:00
|
|
|
|
});
|
2016-06-07 15:40:28 +08:00
|
|
|
|
function expand_reply(container, btnid) {
|
|
|
|
|
var target = $(container);
|
|
|
|
|
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();
|
|
|
|
|
}
|
2015-12-24 10:40:00 +08:00
|
|
|
|
}
|
2016-06-07 15:40:28 +08:00
|
|
|
|
</script>
|
|
|
|
|
<% end %>
|