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

42 lines
1.9 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 => '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("");
$("#homework_editor").toggle();
}
function cancel_edit(){
<% if @is_in_course == 1 %>
window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
<% elsif @is_in_course == 0 %>
window.location.href='<%=user_homeworks_user_path(User.current.id) %>';
<% elsif @is_in_course == -1 && @course_activity == 0 %>
window.location.href='<%=user_path(User.current.id) %>';
<% elsif @is_in_course == -1 && @course_activity == 1 %>
window.location.href='<%=course_path(@course.id) %>';
<% end %>
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作业</div>
</div>
<div class="cl"></div>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10" nhname='homework_common_form'>
<%= form_for @homework do |f| %>
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->