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 = []%>
|
|
|
|
|
<% count=get_all_children(all_comments, @document).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">回复
|
|
|
|
|
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
|
|
|
|
<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
|
|
|
|
|
|
|
|
|
<% all_comments = []%>
|
|
|
|
|
<% comments = get_all_children(all_comments, @document) %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<div class="" id="reply_div_<%= @document.id %>">
|
2016-07-14 17:23:48 +08:00
|
|
|
|
<% comments.each do |comment| %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(function(){
|
2016-07-14 17:23:48 +08:00
|
|
|
|
showNormalImage('reply_content_<%= comment.id %>');
|
|
|
|
|
autoUrl('reply_content_<%= comment.id %>');
|
2015-12-24 10:40:00 +08:00
|
|
|
|
});
|
|
|
|
|
</script>
|
2016-07-14 17:23:48 +08:00
|
|
|
|
<li class="homepagePostReplyContainer" nhname="reply_rec">
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<div class="homepagePostReplyPortrait">
|
2016-07-14 17:23:48 +08:00
|
|
|
|
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="homepagePostReplyDes">
|
2016-07-21 10:30:48 +08:00
|
|
|
|
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
|
|
|
|
|
2016-07-14 17:23:48 +08:00
|
|
|
|
<% 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"}%>
|
2016-01-20 10:53:05 +08:00
|
|
|
|
</span>
|
2016-07-14 17:23:48 +08:00
|
|
|
|
<span style="position: relative" class="fr mr20">
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<%= link_to(
|
|
|
|
|
l(:button_reply),
|
2016-07-14 17:23:48 +08:00
|
|
|
|
{:controller => 'org_document_comments',:action => 'quote',:user_id=>comment.creator_id, :id => comment.id},
|
2015-12-24 10:40:00 +08:00
|
|
|
|
:remote => true,
|
|
|
|
|
:method => 'get',
|
2016-07-14 17:23:48 +08:00
|
|
|
|
:title => l(:button_reply)) %>
|
|
|
|
|
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
|
|
|
|
</span>
|
|
|
|
|
<% if comment.creator_user == User.current %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<%= link_to(
|
|
|
|
|
l(:button_delete),
|
2016-07-14 17:23:48 +08:00
|
|
|
|
{:controller => 'org_document_comments',:action => 'delete_reply', :id => comment.id},
|
2015-12-24 10:40:00 +08:00
|
|
|
|
:method => :delete,
|
2016-07-14 17:23:48 +08:00
|
|
|
|
:class => 'fr mr20',
|
2015-12-24 10:40:00 +08:00
|
|
|
|
:data => {:confirm => l(:text_are_you_sure)},
|
2016-07-14 17:23:48 +08:00
|
|
|
|
:title => l(:button_delete)) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</span>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p id="reply_message_<%= comment.id%>"></p>
|
|
|
|
|
<% end %>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
2016-07-14 17:23:48 +08:00
|
|
|
|
</li>
|
2015-12-24 10:40:00 +08:00
|
|
|
|
<% end %>
|
2016-07-14 17:23:48 +08:00
|
|
|
|
|
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 %>
|