diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 5e290d678..b8c6a4a0a 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -85,6 +85,14 @@ class HomeworkCommonController < ApplicationController homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new @homework.end_time = params[:homework_common][:end_time] || Time.now @homework.course_id = params[:course_id] + if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type + if @homework.homework_type == 2 + @homework.homework_detail_programing.destroy if @homework.homework_detail_programing + @homework.homework_tests.destroy_all + elsif @homework.homework_type == 3 + @homework.homework_detail_group.destroy if @homework.homework_detail_group + end + end @homework.homework_type = params[:homework_type].to_i || @homework.homework_type anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 if anonymous != @homework.anonymous_comment diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index a6dec8161..e8c061b5c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -571,7 +571,7 @@ class StudentWorkController < ApplicationController @student_work = StudentWork.new #end respond_to do |format| - format.html{ render :layout => "new_base_user"} + format.html{ render :layout => "base_courses"} end end @@ -657,7 +657,7 @@ class StudentWorkController < ApplicationController render_403 else respond_to do |format| - format.html{ render :layout => "new_base_user"} + format.html{ render :layout => "base_courses"} end end end diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index 931cdc1de..657bdf486 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -2,6 +2,7 @@ <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> <%= javascript_include_tag 'homework','baiduTemplate' %> <% end %> +
编辑作品
@@ -83,6 +84,7 @@ <% end%>
+ -
+
+
提交作品
@@ -297,4 +298,5 @@
<% end%>
-
\ No newline at end of file + +