From 9002844188e3dacc0e3b424ea7b0efe54d443703 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 13 Sep 2016 16:18:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E5=8F=91=E5=B8=83=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 1 + app/controllers/users_controller.rb | 2 +- app/helpers/application_helper.rb | 18 +++ app/views/homework_common/edit.html.erb | 14 +++ app/views/users/_user_group_attr.html.erb | 52 ++++---- .../users/_user_homework_attachment.html.erb | 11 -- app/views/users/_user_homework_form.html.erb | 116 +++++++++--------- .../users/_user_programing_attr.html.erb | 83 ++++++++----- app/views/users/user_select_homework.js.erb | 10 +- public/javascripts/course.js | 51 ++++++++ public/javascripts/new_user.js | 51 ++++++++ public/stylesheets/css/common.css | 1 + 12 files changed, 275 insertions(+), 135 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6704f7401..0fddd7e6c 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -85,6 +85,7 @@ 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] + @homework.homework_type = params[:homework_type].to_i || @homework.homework_type anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0 if anonymous != @homework.anonymous_comment if anonymous == 1 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 559f29235..2a91b75ae 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1052,7 +1052,7 @@ class UsersController < ApplicationController else homework.publish_time = params[:homework_common][:publish_time] end - homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 + homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1 homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 10 homework.teacher_priority = 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 94b0b2c6e..a370f226c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3521,3 +3521,21 @@ def get_forge_act_message(act, type) format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) end +#作业类型 +def homework_type_option + type = [] + option1 = [] + option1 << "普通作业" + option1 << 1 + option2 = [] + option2 << "编程作业" + option2 << 2 + option3 = [] + option3 << "分组作业" + option3 << 3 + type << option1 + type << option2 + type << option3 + type +end + diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 1bd71e7a9..4a3de027b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -41,6 +41,20 @@
+ <% committed_work_count = @homework.student_works.has_committed.count %> + <% stu_pro_count = @homework.student_work_projects.count %> + <% if committed_work_count != 0 %> + <% if @homework.homework_type == 1 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。

+ <% elsif @homework.homework_type == 2 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。

+ <% elsif @homework.homework_type == 3 %> +

已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置。

+ <% end %> + <% elsif stu_pro_count != 0 && @homework.homework_type == 3 %> +

已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。

+ <% end %> + <%= form_for @homework do |f| %> diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index 6d09f6896..4596ef411 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -1,27 +1,27 @@ -分组设置 - -
- 每组最小人数: - 人 - +
+
分组设置: +
每组最小人数: + />人 +
+
每组最大人数: + />人 +
+ +
+
+ +

提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计

+
+
+
-
- 每组最大人数: - 人 - -
-

-
- -

提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计

-
-
- 确定 -
-
- 取消 -
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 6051d8de9..4f35326b0 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -71,17 +71,6 @@ 上传附件 <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %> - <% if defined?(has_program) && has_program %> -
- 编程 - -
- <% end %> - <% if defined?(has_group) && has_group %> -
- 分组 -
- <% end %>
<% content_for :header_tags do %> diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index b3f9970c6..231c78b91 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -1,3 +1,4 @@ +<% not_allow_select = edit_mode && homework.student_works.has_committed.count != 0 %> <% content_for :header_tags do %> <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> @@ -5,14 +6,31 @@ - - - - - - - - <% unless edit_mode %>