socialforge/app/views/works/edit.html.erb

50 lines
2.4 KiB
Plaintext

<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => @homework, :isReply => false})%>");
//homework_description_editor.html("");
$("#homework_name_span").text("");
$("#homework_end_time_span").text("");
$("#homework_end_time_span").text("");
$("#homework_course_id_span").text("");
$("#homework_editor").toggle();
}
function cancel_edit(){
<% if @hw_status == 3 %>
window.location.href='<%= works_path(:contest => @contest.id) %>';
<% elsif @hw_status == 1 %>
window.location.href='<%= user_contest_community_path(User.current.id) %>';
<% elsif @hw_status == 2 %>
window.location.href='<%= contest_path(@contest.id) %>';
<% end %>
}
</script>
<div class="homepageRightBanner mb10 <%= (@hw_status == 2 || @hw_status == 3 || @hw_status == 5) ? 'ml10' : '' %>">
<div class="NewsBannerName">编辑题目</div>
</div>
<div class="cl"></div>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
<% committed_work_count = @homework.contestant_works.count %>
<% stu_pro_count = @homework.contestant_work_projects.count %>
<% if committed_work_count != 0 %>
<% if @homework.work_type == 1 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.work_type == 3 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
<% end %>
<% elsif stu_pro_count != 0 && @homework.work_type == 3 %>
<p class="c_red mb5">已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。</p>
<% end %>
<%= form_for @homework do |f| %>
<input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
<div id="HomeWorkCon">
<%= render :partial => 'contest_work_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->