From 34db84e79f77bff188e63294e09a164390e02be7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 18 Sep 2015 20:27:13 +0800 Subject: [PATCH 1/5] test --- db/migrate/20150918063404_normal_homework_type.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20150918063404_normal_homework_type.rb b/db/migrate/20150918063404_normal_homework_type.rb index def3b0024..0d70d94be 100644 --- a/db/migrate/20150918063404_normal_homework_type.rb +++ b/db/migrate/20150918063404_normal_homework_type.rb @@ -4,5 +4,6 @@ class NormalHomeworkType < ActiveRecord::Migration end def down + HomeworkCommon.where("homework_type = 0").update_all(:homework_type => 1) end end From 05f7bf96346dd59e2c41c7e0847ef93650c619a8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 18 Sep 2015 20:35:57 +0800 Subject: [PATCH 2/5] test1 --- app/controllers/zipdown_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 53b40942a..1a01ac97b 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -1,4 +1,4 @@ -require 'zip' +require 'zip' class ZipdownController < ApplicationController #查找项目(课程) before_filter :find_project_by_bid_id, :only => [:assort] @@ -7,7 +7,7 @@ class ZipdownController < ApplicationController SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" - #统一下载功能 + #统一下载功能 def download if User.current.logged? begin From 3e57aa1392c7ec77e95fee3e97b5bb254fb0f70a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 19 Sep 2015 10:33:38 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1=E3=80=81=E6=95=99=E5=B8=88=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E5=9C=A8=E5=8A=A8=E6=80=81=E7=95=8C=E9=9D=A2=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=AD=94=E9=A2=98=202=E3=80=81=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=9C=A8=E5=8A=A8=E6=80=81=E7=95=8C=E9=9D=A2=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BD=9C=E5=93=81=203=E3=80=81=E5=8A=A8=E6=80=81=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=89=80=E5=A4=84=E5=8C=BF=E8=AF=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 58b29696c..5ba83401c 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -12,13 +12,38 @@ <% end %> TO <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%> -
+ + <% if activity.homework_detail_manual.comment_status == 1%> + 未开启匿评 + <% elsif activity.homework_detail_manual.comment_status == 2%> + 匿评中 + <% elsif activity.homework_detail_manual.comment_status == 3%> + 匿评已结束 + <% end%>
- <%= student_work_activity_submit_status(homework: activity) %> + <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> + <%= user_for_homework_common activity,is_teacher %>
+ + <% if activity.homework_type == 2 && is_teacher%> +
+ <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> +
+ <% end %> + <% if activity.homework_type == 2%> +
+ 语言: + <% if activity.homework_detail_programing.language.to_i == 1%> + C + <% elsif activity.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
+ <% end %> +
截止时间:<%= activity.end_time.to_s %>
From 7ba27026ae4024a9536e03a787b12a3455a62e75 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 19 Sep 2015 10:45:42 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=9C=A8=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=86=85=E7=BC=96=E8=BE=91=E3=80=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=B9=8B=E5=90=8E=E4=BB=8D=E7=84=B6=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=9B=9E=E5=BD=93=E5=89=8D=E8=AF=BE=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 15 +++++++++++++-- app/views/homework_common/edit.html.erb | 1 + app/views/homework_common/index.html.erb | 4 ++-- app/views/users/_user_homework_list.html.erb | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 35d6f2b85..5530886df 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -137,6 +137,7 @@ class HomeworkCommonController < ApplicationController def edit @user = User.current + @is_in_course = params[:is_in_course] respond_to do |format| format.html{render :layout => 'new_base_user'} end @@ -173,7 +174,11 @@ class HomeworkCommonController < ApplicationController if @homework.save @homework_detail_manual.save if @homework_detail_manual @homework_detail_programing.save if @homework_detail_programing - redirect_to user_homeworks_user_path(User.current.id) + if params[:is_in_course] == "1" + redirect_to homework_common_index_path(:course => @course.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end end end end @@ -181,7 +186,13 @@ class HomeworkCommonController < ApplicationController def destroy if @homework.destroy respond_to do |format| - format.html {redirect_to user_homeworks_user_path(User.current.id)} + format.html { + if params[:is_in_course] == "1" + redirect_to homework_common_index_path(:course => @course.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end + } end end end diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index d6815a00a..5fc11728b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -16,6 +16,7 @@
<%= form_for @homework do |f| %> +
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index d7723452b..693ddba65 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -26,8 +26,8 @@

<% if @is_teacher%> <%= homework_anonymous_comment(homework)%> - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> - <%= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %> + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> + <%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit") %> <% elsif @is_student%> <%= student_anonymous_comment homework %> <%= student_new_homework homework %> diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index c6e827291..e7addad97 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -59,10 +59,10 @@
    • - <%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%> + <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => 0), :class => "postOptionLink"%>
    • - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
    • <%= homework_anonymous_comment homework_common %> From 5313bf0e3d1d8da4e723f79e915a6f50d0ea38a0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 19 Sep 2015 10:48:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=85=B7=E4=BD=93=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E4=B8=AD=E4=B9=9F=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E7=9C=8B=E5=88=B0=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=9A=84=E5=8C=BF=E8=AF=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1982542a9..d7fac9a7d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2368,7 +2368,7 @@ module ApplicationHelper end def student_anonymous_comment homework - if homework.homework_type == 1 && homework.homework_detail_manual + if homework.homework_detail_manual case homework.homework_detail_manual.comment_status when 1 "未开启匿评".html_safe @@ -2377,10 +2377,6 @@ module ApplicationHelper when 3 "匿评已结束".html_safe end - elsif homework.homework_type == 0 - "未启用匿评".html_safe - elsif homework.homework_type == 2 - " 编程作业  ".html_safe end end