diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index d2aba1386..dd2a5b5fc 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -3,8 +3,8 @@ class StudentWorkController < ApplicationController include StudentWorkHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment] - before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work] + before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment] @@ -222,7 +222,7 @@ class StudentWorkController < ApplicationController def edit @user = User.current - if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 + if (!User.current.admin? && @homework.homework_type == 2) || Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") #编程作业不能修改作业|| 截止日期已到不能修改作业 render_403 else respond_to do |format| @@ -284,6 +284,23 @@ class StudentWorkController < ApplicationController end end + def delete_work + @work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first + if @work + @work.destroy + end + redirect_to user_homeworks_user_path(User.current.id) + end + + def retry_work + if @work.destroy + @student_work = StudentWork.new + respond_to do |format| + format.js + end + end + end + #添加评分,已评分则为修改评分 def add_score @is_last = params[:is_last] == "true" diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index f8a55a03d..90d749af1 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -19,9 +19,10 @@

- + 确  定 + <%= link_to("重试", retry_work_student_work_path(@student_work.id),:class => "tijiao",:style =>"margin-bottom: 15px;margin-top:15px;",:remote => true)%>
diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index afd8617aa..67a1ccb50 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -11,7 +11,7 @@ showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + - ""); + ""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("anonymos"); <% else %> diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 4f9999277..ee0dd7e9b 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -99,7 +99,7 @@
- 关联项目 + 关联项目
@@ -111,9 +111,9 @@
- 确定 + 提交 - <%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%> + <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
<% end%> diff --git a/app/views/student_work/retry_work.js.erb b/app/views/student_work/retry_work.js.erb new file mode 100644 index 000000000..c5fca76d4 --- /dev/null +++ b/app/views/student_work/retry_work.js.erb @@ -0,0 +1,2 @@ +hideModal('#popbox02'); +$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false})%>"); \ No newline at end of file diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index efaed2d9d..cfc098645 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -97,7 +97,7 @@ - + diff --git a/config/routes.rb b/config/routes.rb index bfe62bc3f..f6fe95a33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -206,11 +206,13 @@ RedmineApp::Application.routes.draw do resources :student_work do member do post 'add_score' + get 'retry_work' get 'praise_student_work' get 'forbidden_anonymous_comment' end collection do post 'add_score_reply' + get 'delete_work' get 'destroy_score_reply' get 'student_work_absence_penalty' get 'absence_penalty_list' diff --git a/db/schema.rb b/db/schema.rb index 886f233a8..6ad6c585f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -738,6 +738,17 @@ ActiveRecord::Schema.define(:version => 20151203072815) do add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + create_table "homework_detail_manuals", :force => true do |t| t.float "ta_proportion" t.integer "comment_status" diff --git a/public/images/course/hwork_icon.png b/public/images/course/hwork_icon.png new file mode 100644 index 000000000..82c78ac60 Binary files /dev/null and b/public/images/course/hwork_icon.png differ diff --git a/public/images/course/right-arrow.png b/public/images/course/right-arrow.png new file mode 100644 index 000000000..b152e9ce9 Binary files /dev/null and b/public/images/course/right-arrow.png differ diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index f1b6e1814..468548179 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -19,7 +19,7 @@ $(function(){ return false; } return true; - } + }; var test_program = function(cb){ var homework_id = $('#test-program-btn').attr('data-homework-id'); @@ -171,7 +171,7 @@ $(function(){ $("input[name=homework_type]").after(html); } return valid; - } + }; $("#BluePopupBox a.BlueCirBtn").live('click', function(){ if(saveProgramAnswers()){ diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 2fb32e2d0..57838bdba 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1175,4 +1175,20 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;} .rankPortrait {border-radius:50%; width:35px; height:35px;} .numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;} -.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;} +.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;} +/*20151130课程项目集成Tim*/ +a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;} +.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;} +.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;} +a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +.addMemberC {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:227px; background-color:#f1f1f1; min-height:150px; padding-top:10px;} +.addMemberC li {padding-left:10px; line-height:18px;} +.addMemberC li:hover {cursor:pointer; background-color:#cccccc;} +.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} +.rightArrow {margin:50px 15px 0px 15px; float:left;} +.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index a08fd6f33..ad07259d3 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1349,3 +1349,19 @@ span.author { font-size: 0.9em; color: #888; } .pageCell:hover {border:1px solid #3498db; z-index:10;} .pageCellActive {background-color:#3498db; border:1px solid #3498db !important; position:relative; color:#ffffff;} +/*20151130课程项目集成Tim*/ +a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;} +.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;} +.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;} +a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +.addMemberC {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:227px; background-color:#f1f1f1; min-height:150px; padding-top:10px;} +.addMemberC li {padding-left:10px; line-height:18px;} +.addMemberC li:hover {cursor:pointer; background-color:#cccccc;} +.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} +.rightArrow {margin:50px 15px 0px 15px; float:left;} +.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}