From abdc08c7afb9ff49efc231701b1a5bf6ce974b47 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 14 Sep 2016 20:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=E6=97=B6?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA=E6=A0=8F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=9A=84=E5=AF=BC=E8=88=AA=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 8 ++++++++ app/controllers/student_work_controller.rb | 4 ++-- app/views/student_work/edit.html.erb | 2 ++ app/views/student_work/new.html.erb | 6 ++++-- 4 files changed, 16 insertions(+), 4 deletions(-) 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 + +