1、作业描述、编程作业代码字段改为longtext

2、提交作业界面显示修改
3、编程作业不可以修改和删除control判断
This commit is contained in:
sw 2015-07-08 17:19:11 +08:00
parent 2ed2ba97fa
commit 8f3ac85fec
5 changed files with 31 additions and 20 deletions

View File

@ -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)

View File

@ -2,14 +2,6 @@
<h2 class="project_h2">编辑作品</h2>
</div>
<div class="Newwork">
<!--<div id="tb_" class="hwork_tb_">-->
<!--<ul>-->
<!--<li id="tb_1" class="hwork_hovertab" onclick="x:HoverLi(1);" >-->
<!--课程名称课程名称课程名</li>-->
<!--<li id="tb_2" class="hwork_normaltab" onclick="i:HoverLi(2);">-->
<!--成员</li>-->
<!--</ul>-->
<!--</div>-->
<div class="hwork_ctt">
<div class="hwork_dis" id="tbc_01">
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>

View File

@ -49,8 +49,12 @@
</p>
<div class="cl"></div>
<p>
<label class="fl"><span class="c_red">*</span>&nbsp;&nbsp;作品描述&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= f.text_area "description", :class => "w620 hwork_txt ", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexStudentWorkDescription();"%>
<label class="fl">
<span class="c_red">*</span>&nbsp;
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
</p>

View File

@ -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

View File

@ -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|