<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %>
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %>
<%= 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 %> 首页 <% else %> 组织文章 <% end %>
<%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %>
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %>
<% unless @document.content.blank? %>
<%= @document.content.html_safe %>
<% end %>
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %> <%#= link_to_attachments_course @document, :author => false %>
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %>
    • <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> 设为首页 <% end %>
    • <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
    • <%= 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' %>
<% end %>
<% comments_for_doc = @document.children.reorder("created_at desc") %> <% count = @document.children.count() %>
<%# if count > 0 %>
回复 <%= count>0 ? "(#{count})" : "" %> <% if @document.creator_id.to_i == User.current.id.to_i %> <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%> <% end %>
<% comments_for_doc.each_with_index do |reply,i| %> <% user = User.find(reply.creator_id) %>
<%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_url_in_org(user.id) %>
<%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "newsBlue mr10 f14" %>
<%= reply.content.html_safe unless reply.content.nil? %>
<%= format_time(reply.created_at) %> <% if reply.creator_id.to_i == User.current.id.to_i %> <% else %> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> <% end %>

<% end %>
<%# end %> <% if User.current.logged?%>
<%= 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| %> <%= f.kindeditor :org_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 %>
<% end %>