<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'  %>
<div class="project_r_h">
  <h2 class="project_h2"><%= l(:label_course_news) %></h2>
</div>
<div class="problem_main">
  <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
  <div class="problem_txt fl mt5 list_style">
    <h4 class="r_txt_tit mb5">
      <%=h @news.title %>
    </h4>
    <%= link_to(l(:button_edit),
                edit_news_path(@news),
                :class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
    <%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
    <div class="cl"></div>
    <div class="mb5 upload_img">
      <%= @news.description.html_safe %>
      <br />
      <%= l(:label_create_time) %> ：  <%= format_time(@news.created_on) %>
    </div>
    <%= link_to_attachments_course @news %>
    <!--<a href="#" class=" link_file">附件：爱覅俄方if.zip(27.5kB)</a> -->
  </div>
  <div class="cl"></div>
</div>

  <% if @news.commentable? %>
      <div class="msg_box fl">
        <h4><%= l(:label_comment_add) %></h4>
        <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
          <div class="box"  id="news_comment">
            <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
            <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
          </div>
          <p id="add_reply_news"></p>
         <p class="mt10">
            <a href="javascript:void(0)" class="grey_btn fr ml10" onclick="KindEditor.instances[0].html('');">
              <%= l(:label_cancel_with_space) %>
            </a>
            <a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
              <%= l(:label_comment_with_space) %>
            </a>
          </p>
      <% end %>
      </div>
  <% end %>
<div class="cl"></div>
  <% comments = @comments.reverse %>
  <% comments.each do |comment| %>
      <% next if comment.new_record? %>
      <div class="ping_C mb10">
        <div><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "problem_pic fl"%></div>
        <div class="ping_discon">
          <div class="ping_distop upload_img break_word list_style">
            <%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %>
            <span class="c_grey fr">
                <%= format_time(comment.created_on) %>
            </span>
            <div class="cl"></div>
            <p><%= comment.comments.html_safe %></p>
            </div>
            <div class="ping_disfoot">
              <%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
                     :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
          </div>

        </div>
        <div class="cl"></div>
      </div>
  <% end if @comments.any? %>



<!--problem_main end-->
  <% content_for :header_tags do %>
      <%= stylesheet_link_tag 'scm' %>
  <% end %>


<% html_title @news.title -%>