<!-- 此界面只用来新建匿评作业作品 -->
<script type="text/javascript">
  <%if @homework.homework_detail_manual.comment_status != 1%>
    $(function(){
        $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
        showModal('ajax-modal', '360px');
        $('#ajax-modal').siblings().remove();
        $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
        "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
        $('#ajax-modal').parent().css("top","65%").css("left","60%");
        $('#ajax-modal').parent().addClass("anonymos_work");
    });
  <% end%>

  //快速创建项目的弹框
  function new_project(){
      $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_project') %>');
      showModal('ajax-modal', '800px');
      $('#ajax-modal').siblings().remove();
      $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
      "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
      $('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
  }
</script>

<div class="homepageRightBanner mb10">
  <div class="NewsBannerName">提交作品</div>
</div>
<div class="cl"></div>

<div class="HomeWork" id="users_setting">

  <div class="HomeWorkBox">
    <div class="">
      <div class="homepagePostTitle fl">
        <%= @homework.name%>（作业名称）
      </div>
      <span class="fr c_grey">
        截止时间：<%= @homework.end_time%>
      </span>
      <div class="cl"></div>
      <a href="javascript:void(0);" class="c_blue">
        <%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
      </a>
      <div class="cl"></div>
      <div class="HomeWorkP">
        <%= @homework.description.html_safe %>
      </div>
    </div>
  </div><!----HomeWorkBox end-->
  <div class="cl"></div>

  <div class="HomeWorkCon mt15">
    <%= form_for(@student_work,
                 :html => { :multipart => true },
                 :url => {:controller => 'student_work',
                          :action => 'create',
                          :homework => @homework.id
                 }) do |f|%>
        <div class=" c_red mb10">
          提示：作品名称和描述中不要出现真实的姓名信息
        </div>
        <div class="cl"></div>

        <div>
          <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox  W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
          <div class="cl"></div>
          <p id="student_work_name_span" class="c_red mb10"></p>
        </div>
        <div class="mt10">
          <%= f.text_area "description", :class => "InputBox  W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%>
          <script>
              var text = document.getElementById("student_work_description");
              autoTextarea(text);// 调用
          </script>
          <div class="cl"></div>
          <p id="student_work_description_textarea" class="c_red mb10"></p>
        </div>

        <div id="homework_attachments">
          <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false} %>
        </div>

        <div class="mt5 fl">
            <a href="javascript:void(0);" class="RalationIcon fl  mt3" onclick="show_project();">关联项目</a>
        </div>
        <div class="cl"></div>

        <div class="mt10 none" id="about_project">
          <%= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox  W680 fl"} %>
          <%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
          <a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a>
          <div class="cl"></div>
        </div>

        <div class="mt5">
          <a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="new_student_work();">确定</a>
          <span class="fr mr10 mt3">或</span>
          <%= link_to "取消",  user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
        </div>
        <div class="cl"></div>
    <% end%>
  </div><!----HomeWorkCon end-->
</div>