<%= content_for(:header_tags) do %>
    <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<script type="text/javascript">
    $(function() {
        sd_create_editor_from_data(<%= @syllabus.id %>, null, "100%", "<%= @syllabus.class.to_s %>");
        showNormalImage('syllabus_description_<%= @syllabus.id %>');
        $("#syllabus_description_<%= @syllabus.id%> p,#syllabus_description_<%= @syllabus.id%> span,#syllabus_description_<%= @syllabus.id%> em").each(function(){
            var postContent = $(this).html();
            postContent = postContent.replace(/&nbsp;/g," ");
            postContent= postContent.replace(/ {2}/g,"&nbsp; ");
            postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
            postContent=postContent.replace(/&nbsp;  /g,"&nbsp;&nbsp; ");
            $(this).html(postContent);
        });
        autoUrl('syllabus_description_<%= @syllabus.id %>');
    });
</script>
<ul id="sy_tab_nav">
  <li id="sy_tab_nav_1" class="sy_tab_hover" onclick="HoverLi(1);">
    <a href="javascript:void(0);" class="sy_tab_type" >课程大纲</a>
  </li>
  <li id="sy_tab_nav_2"  onclick="HoverLi(2);">
    <a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
  </li>
  <li id="sy_tab_nav_3"  onclick="HoverLi(3);">
    <a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
  </li>
</ul>
<div id="sy_tab_con_1">
  <% if @syllabus.des_status == 0 && User.current == @syllabus.user %>
      <div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
      <p class="sy_tab_con_p">您建立的课程尚未填写课程大纲，请完善您的 <%=link_to '课程大纲', edit_syllabus_path(@syllabus), :class => 'sy_corange' %>，谢谢啦！</p>
  <% elsif @syllabus.des_status == 0 %>
      <div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
      <p class="sy_tab_con_p">该课程尚未填写课程大纲，敬请期待！</p>
  <% else %>
      <div class="sy_tab_con">
        <div class="syllabuscon upload_img" id="syllabus_description_<%= @syllabus.id %>">
          <%=@syllabus.description.html_safe %>
        </div>
        <div class="mt10" style="font-weight:normal; font-size: 12px;">
          <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @syllabus} %>
        </div>
        <% if User.current.logged? && User.current == @syllabus.user%>
            <div class="homepagePostSetting" style="margin:10px;">
              <ul>
                <li class="homepagePostSettingIcon">
                  <ul class="homepagePostSettiongText">
                    <li><%=link_to '编辑', edit_syllabus_path(@syllabus), :class => 'postOptionLink'%></li>
                    <li><%=link_to '删除', delete_des_syllabus_path(@syllabus), :class => 'postOptionLink', :confirm => l(:text_are_you_sure)%></li>
                  </ul>
                </li>
              </ul>
            </div>
            <div class="cl"></div>
        <% end %>
        <div class="fr fontGrey2">更新时间：<%=format_time @syllabus.updated_at %><div></div></div>
        <div class="cl"></div>
      </div><!--HomeWork end-->
  <% end %>
  <% count=@syllabus.journals_for_messages.count %>
  <div class="homepagePostReply" style="margin-bottom: 20px;">
    <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => @syllabus, :user_activity_id => @syllabus.id} %>

    <% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %>
    <% if count > 0 %>
        <div class="" id="reply_div_<%= @syllabus.id %>">
          <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus', :activity_id => @syllabus.id} %>
        </div>
    <% end %>
    <div class="homepagePostReplyContainer borderBottomNone minHeight48">
      <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @syllabus.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
      <div class="homepagePostReplyInputContainer mb10">
        <% if User.current.logged? %>
            <div nhname='new_message_<%= @syllabus.id%>' style="display:none;">
              <%= form_for('new_form',:url =>  {:controller => 'words', :action => 'leave_syllabus_message', :id => @syllabus.id},:method => "post") do |f|%>
                  <div nhname='toolbar_container_<%= @syllabus.id%>'></div>
                  <textarea placeholder="有问题或有建议，请直接给我留言吧！" style="display: none" nhname='new_message_textarea_<%= @syllabus.id%>' name="comment"></textarea>
                  <a id="new_message_submit_btn_<%= @syllabus.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
                  <div class="cl"></div>
                  <p nhname='contentmsg_<%= @syllabus.id%>'></p>
              <% end%>
            </div>
        <% else %>
            <%= render :partial => "users/show_unlogged" %>
        <% end %>
        <div class="cl"></div>
      </div>
      <div class="cl"></div>
    </div>
    <div class="cl"></div>
  </div><!--回复框 用正式版样式-->
</div><!--课程大纲 end-->


