<ul>
  <% comments.each do |comment| %>
      <script type="text/javascript">
          $(function(){
              showNormalImage('reply_content_<%= comment.id %>');
              autoUrl('reply_content_<%= comment.id %>');
          });
      </script>
      <li class="homepagePostReplyContainer" nhname="reply_rec">
        <div class="homepagePostReplyPortrait">
          <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
        </div>
        <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity_id %>_<%=comment.id %>').hide();">
          <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>

          <% 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"}%>
                    </span>
                  <% if type == 'Message' %>
                    <% topic = comment.root %>
                    <% if !topic.locked? && authorize_for('messages', 'reply') %>
                    <span style="position: relative" class="fr mr20">
                        <%= link_to(
                                    l(:button_reply),
                                    {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board},
                                    :remote => true,
                                    :method => 'get',
                                    :title => l(:button_reply)) %>
                      <span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
                    </span>
                    <% end %>
                    <% if comment.course_destroyable_by?(User.current) || comment.destroyable_by?(User.current) %>
                      <%= link_to(
                                  l(:button_delete),
                                  delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board),
                                  :method => :post,
                                  :remote => true,
                                  :id => "delete_reply_#{activity_id}_#{comment.id}",
                                  :class => 'fr mr20 undis',
                                  :data => {:confirm => l(:text_are_you_sure)},
                                  :title => l(:button_delete)
                          ) %>
                    <% end %>
                  <% elsif type == 'JournalsForMessage' %>
                    <span style="position: relative" class="fr mr20">
                        <%= link_to(
                                    l(:button_reply),
                                    {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
                                    :remote => true,
                                    :method => 'get',
                                    :title => l(:button_reply)) %>
                    <span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
                    </span>
                      <% if comment.creator_user == User.current || User.current.admin? %>
                        <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id},
                                    :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete))  %>
                      <% end %>
                  <% elsif type == 'OrgDocumentComment' %>
                      <span style="position: relative" class="fr mr20">
                        <%= link_to(
                                    l(:button_reply),
                                    {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
                                    :remote => true,
                                    :method => 'get',
                                    :title => l(:button_reply)) %>
                        <span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
                      </span>
                      <% if comment.creator_user == User.current %>
                        <%= link_to(
                                  l(:button_delete),
                                  {:controller => 'org_document_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id},
                                  :method => :delete,
                                  :remote => true,
                                  :id => "delete_reply_#{activity_id}_#{comment.id}",
                                  :class => 'fr mr20 undis',
                                  :data => {:confirm => l(:text_are_you_sure)},
                                  :title => l(:button_delete)) %>
                      <% end %>
                  <% elsif type == 'BlogComment' %>
                      <span style="position: relative" class="fr mr20">
                        <%= link_to(
                                    l(:button_reply),
                                    {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage, :user_id => user_id},
                                    :remote => true,
                                    :method => 'get',
                                    :title => l(:button_reply))  if !comment.root.locked? %>
                        <span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
                      </span>
                      <% if comment.author == User.current %>
                        <%= link_to(
                                  l(:button_delete),
                                  {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage, :user_id => user_id},
                                  :method => :delete,
                                  :remote => true,
                                  :id => "delete_reply_#{activity_id}_#{comment.id}",
                                  :class => 'fr mr20 undis',
                                  :data => {:confirm => l(:text_are_you_sure)},
                                  :title => l(:button_delete)) %>
                      <% end %>
                  <% end %>
                </span>
                  <div class="cl"></div>
                </div>
              </div>
              <p id="reply_message_<%= comment.id%>"></p>
          <% end %>
        </div>
        <div class="cl"></div>
      </li>
  <% end %>
</ul>