From 8f3ac85fec83888be61bd797919b2540fddb87f9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 17:19:11 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E4=B8=9A=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E3=80=81=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=94=B9=E4=B8=BAlongtext=202=E3=80=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BF=AE=E6=94=B9=203=E3=80=81=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=B8=8D=E5=8F=AF=E4=BB=A5=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=92=8C=E5=88=A0=E9=99=A4control=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 12 +++++++++--- app/views/student_work/edit.html.erb | 8 -------- app/views/student_work/new.html.erb | 8 ++++++-- .../20150708085629_change_studen_work_desc.rb | 9 +++++++++ db/schema.rb | 14 +++++++------- 5 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20150708085629_change_studen_work_desc.rb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 429f787e5..0efa0aa66 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -103,8 +103,12 @@ class StudentWorkController < ApplicationController end def edit - respond_to do |format| - format.html + if @homework.homework_type == 2 #编程作业不能修改作业 + render_403 + else + respond_to do |format| + format.html + end end end @@ -139,7 +143,9 @@ class StudentWorkController < ApplicationController end def destroy - if @work.destroy + if @homework.homework_type == 2 #编程作业,作品提交后不可以删除 + render_403 + elsif @work.destroy respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index dfa995f47..6e36447d2 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -2,14 +2,6 @@
- - <%= f.text_area "description", :class => "w620 hwork_txt ", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexStudentWorkDescription();"%> + + <%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
diff --git a/db/migrate/20150708085629_change_studen_work_desc.rb b/db/migrate/20150708085629_change_studen_work_desc.rb new file mode 100644 index 000000000..af3c25671 --- /dev/null +++ b/db/migrate/20150708085629_change_studen_work_desc.rb @@ -0,0 +1,9 @@ +class ChangeStudenWorkDesc < ActiveRecord::Migration + def up + change_column :student_works,:description,:text,:limit => 4294967295 + end + + def down + change_column :student_works,:description,:text + end +end diff --git a/db/schema.rb b/db/schema.rb index 4016cd6a9..539dd95d3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150708025533) do +ActiveRecord::Schema.define(:version => 20150708085629) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1222,18 +1222,18 @@ ActiveRecord::Schema.define(:version => 20150708025533) do create_table "student_works", :force => true do |t| t.string "name" - t.text "description" + t.text "description", :limit => 2147483647 t.integer "homework_common_id" t.integer "user_id" t.float "final_score" t.float "teacher_score" t.float "student_score" t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 end create_table "student_works_evaluation_distributions", :force => true do |t|