<%= form_for @exercise, :remote=>true  do |f| %>
    <div class="testContainer">
      <div>
        <input name="exercise[exercise_name]" maxlength="100" id="exercise_name" class="testTitle mb10" type="text" placeholder="测验标题" value="<%=@exercise.exercise_name%>" />
      </div>
      <label class="fl c_grey f14" style="margin-top: 4px;">截止时间：</label>
      <div class="calendar_div fl">
        <input  type="text" name="exercise[end_time]" id="exercise_end_time" placeholder="截止时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>"/>
        <%= calendar_for('exercise_end_time')%>
      </div>
      <div class="fl ml15 f14 fontGrey2"><span class="mr5">测验时长:</span><input name="exercise[time]" id="exercise_time" type="text" class="examTime mr5" placeholder="不填即不限时" value="<%=exercise.time if exercise.time!= -1 %>" />分钟</div>
      <label class="fl c_grey ml15 f14" style="margin-top: 4px;">发布时间(可选)：</label>
      <div class="calendar_div fl">
        <input  type="text" name="exercise[publish_time]" id="exercise_publish_time" placeholder="发布时间(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil? %>"/>
        <%= calendar_for('exercise_publish_time')%>
      </div>
      <div class="cl"></div>
      <textarea class="testDes mt10" name="exercise[exercise_description]" id="exercise_description" placeholder="发布须知：试题类型有选择和填空两种，其中选择题包括单选题和多选题。您可以在此处填写测验相关说明。" ><%=exercise.exercise_description %></textarea>
      <div class="ur_editor_footer" style="padding-top: 10px;">
        <a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
          保存
        </a>
        <a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">
          <%= l(:button_cancel)%>
        </a>
      </div>
      <div class="cl"></div>
    </div>
<% end %>
<script type="text/javascript">
    function resetHead()
    {
        $("#exercise_name").val("<%=exercise.exercise_name%>");
        $("#exercise_end_time").val("<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>");
        $("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>");
        $("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>");
        /*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/
    }
</script>