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

64 lines
3.1 KiB
Plaintext
Raw Normal View History

2015-09-10 17:11:16 +08:00
<script type="text/javascript">
2016-09-19 17:14:14 +08:00
<% if @hw_status != 1 %>
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
<% end %>
2015-09-10 17:11:16 +08:00
function reset_homework(){
$("#homework_name").val("");
2015-10-30 13:58:54 +08:00
$("#homework_publish_time").val("");
2015-09-10 17:11:16 +08:00
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
//homework_description_editor.html("");
$("#homework_name_span").text("");
$("#homework_end_time_span").text("");
$("#homework_end_time_span").text("");
$("#homework_course_id_span").text("");
2015-09-10 17:11:16 +08:00
$("#homework_editor").toggle();
}
function cancel_edit(){
<% if @is_manage.to_i == 1 %>
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
<% elsif @is_manage.to_i == 2 %>
window.location.href='<%=my_homeworks_user_path(User.current.id) %>';
2016-09-19 17:14:14 +08:00
<% elsif @hw_status == 3 %>
window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
2016-09-19 17:14:14 +08:00
<% elsif @hw_status == 1 %>
window.location.href='<%=user_path(User.current.id) %>';
2016-09-19 17:14:14 +08:00
<% elsif @hw_status == 2 %>
window.location.href='<%=course_path(@course.id) %>';
<% end %>
}
2015-09-10 17:11:16 +08:00
</script>
2016-09-19 17:14:14 +08:00
<div class="homepageRightBanner mb10 <%= (@hw_status == 2 || @hw_status == 3 || @hw_status == 5) ? 'ml10' : '' %>">
2015-09-10 17:11:16 +08:00
<div class="NewsBannerName">编辑作业</div>
</div>
2015-06-17 17:01:03 +08:00
<div class="cl"></div>
2015-09-10 17:11:16 +08:00
<!-- 老师身份才可以发布作业 -->
2016-07-22 18:20:11 +08:00
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
2016-09-13 16:18:57 +08:00
<% committed_work_count = @homework.student_works.has_committed.count %>
<% stu_pro_count = @homework.student_work_projects.count %>
<% if committed_work_count != 0 %>
<% if @homework.homework_type == 1 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.homework_type == 2 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。</p>
<% elsif @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
2016-09-13 16:18:57 +08:00
<% end %>
<% elsif stu_pro_count != 0 && @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。</p>
<% end %>
2015-09-10 17:11:16 +08:00
<%= form_for @homework do |f| %>
2016-09-19 17:14:14 +08:00
<input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
<input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/>
2015-09-10 17:11:16 +08:00
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->