From 4a7fcfaac9f27ba416dfcad80dd15fde8ee5c6e5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 10:39:56 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=98=AF=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 2 +- app/views/bids/start_anonymous_comment.js.erb | 3 ++- app/views/layouts/base_homework.html.erb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 155efe732..f098de895 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -39,7 +39,7 @@ <% when 0 %> <%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评?", disable_with: '加载中...' %> <% when 1 %> - <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分\n是否确定关闭匿评?" %> + <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评?" %> <% when 2 %> 匿评结束 <% end %> diff --git a/app/views/bids/start_anonymous_comment.js.erb b/app/views/bids/start_anonymous_comment.js.erb index 392e999a4..9ae2a712b 100644 --- a/app/views/bids/start_anonymous_comment.js.erb +++ b/app/views/bids/start_anonymous_comment.js.erb @@ -1,7 +1,8 @@ <% if @statue == 1%> alert('启动成功'); $("#<%= @bid.id %>_start_anonymous_comment").remove(); - $("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>'); + $("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment" %>'); + $("#<%= @bid.id%>_stop_anonymous_comment").attr("data-confirm","关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评?"); <% elsif @statue == 2 %> alert('启动失败\n作业总数大于等于2份时才能启动匿评'); <% elsif @statue == 3%> diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index f657a5ff0..e91d0c700 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -109,7 +109,7 @@ <% when 0 %> <%= link_to '启动匿评', start_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评?", disable_with: '加载中...' %> <% when 1 %> - <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分\n是否确定关闭匿评?" %> + <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评?" %> <% when 2 %> 匿评结束 <% end %> From bc36e16e577a3e10f14a3de71a906a03651c04c9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 10:49:00 +0800 Subject: [PATCH 02/14] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=90=8E=E8=B7=B3=E8=BD=AC=E5=88=B0=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=202.=E4=BF=AE=E6=94=B9=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=88=9B=E5=BB=BA=E6=88=90=E5=8A=9F=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2 +- config/locales/zh.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 5fd42a97e..cab954e96 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -823,7 +823,7 @@ class BidsController < ApplicationController flash[:notice] = l(:label_bid_succeed) end end - redirect_to course_for_bid_path(@bid) + redirect_to course_homework_url(params[:course_id]) else @bid.safe_attributes = params[:bid] @homework = @bid diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 9eccc498a..9ac266704 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1459,7 +1459,7 @@ zh: label_newtype_contest: 发布竞赛 label_user_information: "与我相关" - label_bid_succeed: "需求发布成功" + label_bid_succeed: "作业创建成功" label_wrong_budget: 错误的金额格式 label_wrong_date: 时间格式错误,请输入正确的时间 yyyy-mm-dd label_bidding_succeed: 应标成功 From 5e91a258fedeaa415e8258a562a3c6b77460698f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 10:54:39 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=BF=87=E4=BD=9C=E4=B8=9A=E3=80=81=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E6=8F=90=E4=BA=A4=E6=8A=A5403?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 4b7fdb15e..42c7ffc77 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -227,7 +227,7 @@ class HomeworkAttachController < ApplicationController def create bid = Bid.find params[:bid_id] if User.current.admin? || User.current.member_of_course?(bid.courses.first) # modify by nwb - if bid.homeworks.where("user_id = ?",User.current).count == 0 + if bid.homeworks.where("user_id = ?",User.current).empty? user_id = params[:user_id] bid_id = params[:bid_id] if params[:homework_attach] From e5874283f14865883e4137cce0a000892013a547 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 14:13:50 +0800 Subject: [PATCH 04/14] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E5=88=97=E8=A1=A8=E6=8F=90=E4=BA=A4=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=8C=89=E9=92=AE=E9=93=BE=E6=8E=A5=202.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E7=9A=84=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=203.=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E5=9C=A8?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E8=AF=BE=E7=A8=8B=E6=8F=90=E4=BA=A4=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=9A=84=E9=9B=86=E5=90=88=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 3 +-- app/views/bids/_bid_homework_show.html.erb | 12 +++++++++--- app/views/layouts/base_homework.html.erb | 2 +- app/views/welcome/_course_list.html.erb | 20 ++++++++++---------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index eeedbd19d..ba77d1edd 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -343,8 +343,7 @@ module CoursesHelper end #获取当前用户在指定作业下提交的作业的集合 def cur_user_homework_for_bid bid - cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,bid.id) - cur_user_homework + bid.homeworks.where("user_id = ?",User.current) end #判断当前用户对指定作业是否已经评价过 diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index f098de895..bf5f700cb 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -23,10 +23,16 @@ <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> - <% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %> + <% if User.current.logged? && is_cur_course_student(@course) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %> - <% if cur_user_homework!= nil && cur_user_homework.count == 0 %> - <%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %> + <% if cur_user_homework!= nil && cur_user_homework.empty? %> + <% if bid.comment_status == 0 %> + <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> + <% else %> + + 提交作业 + + <% end %> <% else %> <%= l(:lable_has_commit_homework)%> diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index e91d0c700..65b57598a 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -79,7 +79,7 @@ - <%= link_to course.name.to_s, homework_course_path(course) if course %> + <%= link_to "返回课程主页", course_path(course) if course %> diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index 5fdd8cf3d..c33cc841e 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -5,17 +5,17 @@
- - <% unless course.is_public == 1 %> - <%= l(:label_private) %> - <% end %> - <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + + <% unless course.is_public == 1 %> + <%= l(:label_private) %> + <% end %> + <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - - - <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> - <%#=course.try(:teacher).try(:name)%> - + + + <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> + <%#=course.try(:teacher).try(:name)%> +
[<%= get_course_term course %>] From 15e71ae85b4a0be18499b003eef97145d22e08a8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 14:25:21 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A6=E4=B8=8A?= =?UTF-8?q?=E8=A7=92=E4=BD=9C=E4=B8=9A=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=92=8C=E8=AF=BE=E7=A8=8B=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 65b57598a..82ede60ca 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -87,7 +87,9 @@ - <%=link_to(@bid.name, course_for_bid_path(@bid)) %> + + <%=link_to("第#{course.homeworks.index(@bid) + 1}次作业", course_for_bid_path(@bid)) %> + From 61789197359a12220e4838a979e1b5736c13861b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 14:46:01 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=97=B6=E5=BD=93=E5=89=8D=E5=AD=A6=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 + app/helpers/courses_helper.rb | 11 +++++++ app/views/courses/_course_form.html.erb | 38 ++++++++++++++++++------- app/views/courses/new.html.erb | 4 ++- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a048c3c9c..ee1ca0230 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -410,6 +410,7 @@ class CoursesController < ApplicationController @course = Course.new @course.safe_attributes = params[:course] + month = Time.now.month render :layout => 'base' end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index ba77d1edd..ac22ed412 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -475,6 +475,17 @@ module CoursesHelper type << option2 type end + + def cur_course_term + month = Time.now.month + if month >= 9 || month < 3 + term = "秋季学期" + else + term = "春季学期" + end + term + end + #获取课程动态 def get_course_activity courses, activities @course_ids=activities.keys() diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb index 4324c5d47..c9ac7541d 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -43,7 +43,11 @@ <%= text_field_tag :class_period, @course.class_period, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %> -  <%= l(:label_class_hour) %> +   + + <%= l(:label_class_hour) %> + + @@ -53,12 +57,16 @@
- <%= l(:label_class_period) %> - *   + + <%= l(:label_class_period) %> + *   + <%= text_field_tag :class_period, nil, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %> - <%= l(:label_class_hour) %> + + <%= l(:label_class_hour) %> +
@@ -72,13 +80,16 @@
- <%= l(:label_term) %> *   + + <%= l(:label_term) %> + *   + <%= select_tag :time,options_for_select(course_time_option,@course.time), {} %> - <%= select_tag :term,options_for_select(course_term_option,@course.term),{} %> + <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
@@ -88,12 +99,15 @@

-

- <%= l(:text_command) %> + + <%= l(:text_command) %> + <% end %>

-

<%= f.text_field :course_type, :value => 1 %>

+

+ <%= f.text_field :course_type, :value => 1 %> +

<%= wikitoolbar_for 'course_description' %> <% @course.custom_field_values.each do |value| %> -

<%= custom_field_tag_with_label :course, value %>

+

+ <%= custom_field_tag_with_label :course, value %> +

<% end %> <%= call_hook(:view_courses_form, :course => @course, :form => f) %> diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index 8d153a447..77f041322 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -6,7 +6,9 @@ <%= labelled_form_for @course do |f| %>
<%= render :partial => 'course_form', :locals => { :f => f } %> - <%= submit_tag l(:button_create), :class => "enterprise"%> + + <%= submit_tag l(:button_create), :class => "enterprise"%> + <%= javascript_tag "$('#course_name').focus();" %>
From 09f89f23a1ba39ff0f47861a671c93ed1e3d85f3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 14:51:21 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=80=BB=E7=AE=97=E5=A4=A7=E4=BA=8E2=E4=BB=BD=E6=98=AF?= =?UTF-8?q?=E6=89=8D=E6=98=BE=E7=A4=BA=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_bid_homework_show.html.erb | 22 ++++++++++++---------- app/views/layouts/base_homework.html.erb | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index bf5f700cb..c67460fef 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -39,17 +39,19 @@ <% end %> <% end %> - <% if (User.current.admin?||User.current.id==bid.author_id) %> - - <% case bid.comment_status %> - <% when 0 %> - <%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评?", disable_with: '加载中...' %> - <% when 1 %> - <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评?" %> - <% when 2 %> - 匿评结束 + <% if (User.current.admin?||User.current.id==bid.author_id)%> + <% if bid.homeworks.count >= 2 %> + + <% case bid.comment_status %> + <% when 0 %> + <%= link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n是否确定开启匿评?", disable_with: '加载中...' %> + <% when 1 %> + <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => "关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评?" %> + <% when 2 %> + 匿评结束 + <% end %> + <% end %> - <%= link_to( l(:button_edit), {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id}, diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 82ede60ca..01f99ce10 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -103,7 +103,7 @@
- <% if (User.current.admin?||User.current.id==@bid.author_id) %> + <% if (User.current.admin?||User.current.id==@bid.author_id) && bid.homeworks.count >= 2 %>
From 4267026ec12cb71850b81b6edad088d06665c78c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 15:20:30 +0800 Subject: [PATCH 08/14] 111 --- app/views/layouts/base_homework.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 01f99ce10..09b77d62a 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -103,7 +103,7 @@
- <% if (User.current.admin?||User.current.id==@bid.author_id) && bid.homeworks.count >= 2 %> + <% if (User.current.admin?||User.current.id==@bid.author_id) && @bid.homeworks.count >= 2 %> @@ -87,7 +87,9 @@ From e2c034dcefa6b392f08c0c7becceb5f4f33f156b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 11:58:26 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?=E5=B7=B2=E8=AF=84=E5=88=97=E8=A1=A8=EF=BC=8C=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E8=AF=84=E5=88=86=E6=98=BE=E7=A4=BA=E4=B8=BA=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E5=88=86=20=E5=88=86=E6=95=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=BA=E6=88=91=E5=AF=B9=E8=AF=A5=E4=BD=9C=E4=B8=9A=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 3 ++- app/controllers/homework_attach_controller.rb | 3 ++- app/views/bids/_homework_list.html.erb | 2 +- app/views/homework_attach/_homework.html.erb | 6 +++--- config/locales/zh.yml | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index cab954e96..334bc3413 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -508,6 +508,7 @@ class BidsController < ApplicationController WHERE table1.t_score IS NULL") @cur_type = 1 else + m_score_null = @bid.comment_status == 2 ? "IS NOT NULL" : "IS NULL" all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score, @@ -515,7 +516,7 @@ class BidsController < ApplicationController FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 - WHERE table1.m_score IS NULL") + WHERE table1.m_score #{m_score_null}") @is_student_batch_homework = true @cur_type = 4 end diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 42c7ffc77..6b311989e 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -98,6 +98,7 @@ class HomeworkAttachController < ApplicationController #获取学生匿评列表 def get_student_batch_homework + m_score_null = @bid.comment_status == 2 ? "IS NOT NULL" : "IS NULL" @is_student_batch_homework = true teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*, @@ -107,7 +108,7 @@ class HomeworkAttachController < ApplicationController FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 - WHERE table1.m_score IS NULL") + WHERE table1.m_score #{m_score_null}") @cur_page = params[:page] || 1 @cur_type = 4 @homework_list = paginateHelper all_homework_list,10 diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 5421ed8d9..acbcbc2fa 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -29,7 +29,7 @@ <% else %>
  • - <%= link_to "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'student_batch_homework',:remote => true}%> + <%= link_to @bid.comment_status == 2 ? "已评作品" : "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'student_batch_homework',:remote => true}%>
  • <%= link_to "我的作品", get_my_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'my_homework',:remote => true}%> diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index aa1075fae..0fb865884 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -24,7 +24,7 @@ <%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
  • - <% if !is_student_batch_homework %> + <% unless is_student_batch_homework %> <%= l(:label_teacher_score)%>: <%= homework.t_score.nil? ? l(:label_without_score) : format("%.2f",homework.t_score)%> @@ -33,9 +33,9 @@ <% end %>
  • - <%= l(:label_student_score)%>: + <%= is_student_batch_homework ? l(:label_my_score) : l(:label_student_score)%>: - <%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",homework.s_score) %> + <%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",(is_student_batch_homework ? homework.m_score : homework.s_score)) %>
  • <% if is_teacher %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 9ac266704..fa8f46bb0 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2184,4 +2184,5 @@ zh: label_anonymous_comments: 匿评 label_anonymous: 匿名 label_submit_comments: 提交评论 - field_evaluation_num: 匿评分配数量 \ No newline at end of file + field_evaluation_num: 匿评分配数量 + label_my_score: 我的评分 \ No newline at end of file From 48aacc70c96162607f30aa89a4c3f89d187ecaa3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 13:53:57 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E3=80=81=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/edit.html.erb | 36 +++++++++++++------------ app/views/homework_attach/new.html.erb | 16 +++++------ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/app/views/homework_attach/edit.html.erb b/app/views/homework_attach/edit.html.erb index 5530b8cff..55015e2f9 100644 --- a/app/views/homework_attach/edit.html.erb +++ b/app/views/homework_attach/edit.html.erb @@ -64,18 +64,6 @@ <%= f.text_field :name, :required => true, :name => "homework_name", :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();"%>

    -

    - - <% if @homework.project.nil? %> - <%= f.select :project_id, options_for_select(user_projects_option),{}, {:name => "project_id", :required => true,:class => "w350 bo"}%> - <% else %> - <%= f.select :project_id, options_for_select(user_projects_option,@homework.project.id),{},{:name => "project_id", :required => true, :class => "w350 bo"}%> - <% end %> -

    <%#= render :partial => 'attachments/form' %> -

    - <% options = {:author => true, :deletable => attach_delete(@homework)} %> - <%= render :partial => 'attachments/links', - :locals => {:attachments => @homework.attachments, :options => options} %> -

    + <% unless @homework.attachments.empty?%> +

    + <% options = {:author => true, :deletable => attach_delete(@homework)} %> + <%= render :partial => 'attachments/links', + :locals => {:attachments => @homework.attachments, :options => options} %> +

    + <% end %>

    <%= render :partial => 'attachments/form' %>

    +

    + + <% if @homework.project.nil? %> + <%= f.select :project_id, options_for_select(user_projects_option),{}, {:name => "project_id", :required => true,:class => "w350 bo"}%> + <% else %> + <%= f.select :project_id, options_for_select(user_projects_option,@homework.project.id),{},{:name => "project_id", :required => true, :class => "w350 bo"}%> + <% end %> +

    diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index efe143cf0..be40ed485 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -54,14 +54,6 @@ <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();" %>

    -

    - - <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "w350 bo"} %> -

    +

    + + <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "w350 bo"} %> +

    From 14db93c10ad79516d24af6c2ace7639e25302f28 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 14:56:14 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E6=95=99=E5=B8=88=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=BD=93=E5=89=8D=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=8F=90=E4=BA=A4=E4=BF=A1=E6=81=AF,=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BF=A1=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 41 +++++++++++++++---- .../homework_attach/_homeworks_list.html.erb | 6 +++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1a3f13082..eb05c0528 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1911,19 +1911,13 @@ module ApplicationHelper def anonymous_comment_link(bid, course) link = case bid.comment_status when 0 - @student_size ||= searchStudent(course).size - @homework_size = bid.homeworks.size - percent = @homework_size.to_f / @student_size confirm_info = "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n" - confirm_info += percent >= 0.8 ? '' : "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,只占#{number_to_percentage(percent * 100, precision: 1)}\n" + confirm_info += anonymous_comment_notice(bid,course) confirm_info += '是否确定开启匿评?' link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...' when 1 - @student_size ||= searchStudent(course).size - @homework_size = bid.homeworks.size - percent = @homework_size.to_f / @student_size - confirm_info = "关闭匿评后所有同学将看到匿评的结果。学生将可以自由的进行公开互评了,但公开互评不影响作业的匿名评分\n" - confirm_info += "" # TODO 当前有多少学生完成了匿评,有多少学生没有进行匿评,并据此给出建议:建议老师暂缓关闭匿评,因为只有x%的学生完成了匿评任务。。。 + confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作业列表\n" + confirm_info += anonymous_comment_notice(bid,course) confirm_info += '是否确定关闭匿评?' link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info when 2 @@ -1931,4 +1925,33 @@ module ApplicationHelper end content_tag('span', link, id: "#{bid.id}_anonymous_comment") end + + def anonymous_comment_notice(bid, course) + link = + case bid.comment_status + when 0 + @student_size ||= searchStudent(course).size + @homework_size = bid.homeworks.size + percent = @homework_size.to_f / @student_size + confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n" + when 1 + @homework_evaluations = 0 + bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count} + teachers = "(" + teacher_members = searchTeacherAndAssistant(course) + teacher_members.each do |member| + if member == teacher_members.last + teachers += member.user_id.to_s + ")" + else + teachers += member.user_id.to_s + "," + end + end + @has_evaluations = 0 + bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count} + + percent = @has_evaluations.to_f / @homework_evaluations + confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作业,已评价#{@has_evaluations}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n" + end + confirm_info + end end diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index b67e91d84..c778588f7 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -65,3 +65,9 @@ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote, :flag => true%>

<% end %> + +<% if is_teacher %> + + <%= anonymous_comment_notice(@bid, @bid.courses.first) %> + +<% end %>
From 9520007bec79aa584fcc98193a52c56fe67ff902 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 08:44:24 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=9A=90=E8=97=8F=E6=95=99=E5=B8=88=E8=AF=84?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_homework.html.erb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index be83a93ae..aa1075fae 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -24,11 +24,13 @@ <%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
  • - <%= l(:label_teacher_score)%>: - - <%= homework.t_score.nil? ? l(:label_without_score) : format("%.2f",homework.t_score)%> - -    + <% if !is_student_batch_homework %> + <%= l(:label_teacher_score)%>: + + <%= homework.t_score.nil? ? l(:label_without_score) : format("%.2f",homework.t_score)%> + +    + <% end %>
  • <%= l(:label_student_score)%>: From f149dd3a571c52c478ed028f58bf2d1e090b0b9c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 10:58:07 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E6=88=91=E7=9A=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E6=98=AF=E7=BC=BA=E7=9C=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84tab=EF=BC=8C=E7=AD=89=E5=88=B0=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=8C=BF=E8=AF=84=E5=90=8E=EF=BC=8C=E5=BE=85?= =?UTF-8?q?=E8=AF=84=E4=BD=9C=E5=93=81=E6=89=8D=E6=98=AF=E7=BC=BA=E7=9C=81?= =?UTF-8?q?tab=20=E5=AD=A6=E7=94=9F=E7=9A=84=E4=BD=9C=E4=B8=9A=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E4=B8=AD=EF=BC=8C=E2=80=9C=E6=89=80=E6=9C=89=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E2=80=9D=E5=BA=94=E8=AF=A5=E6=98=AF=E7=BC=BA=E7=9C=81?= =?UTF-8?q?=E7=9A=84tab=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework.html.erb | 38 ++++++++++++++++---------- app/views/bids/_homework_list.html.erb | 6 ++-- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 673ea2674..078ca8000 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -27,20 +27,30 @@ $("#what_is_project_div").slideToggle(); } - window.onready = function() - { - <% if !@is_teacher && @homework_list.count > 0 && @bid.comment_status == 1%> - //登录者不是老师,且作业列表数目不为0,且作业处于开启匿评阶段 - var alert_model = "'#ajax-modal'"; - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_attach/praise_alert') %>'); - showModal('ajax-modal', '480px'); - $('#ajax-modal').css('height','240px'); - $('#ajax-modal').before("" + - ""); - $('#ajax-modal').parent().css("top","").css("left","").css("width","511"); - $('#ajax-modal').parent().addClass("alert_praise"); - <% end %> - } + $(document).ready( + function() + { + <% if !@is_teacher && @homework_list.count > 0 && @bid.comment_status == 1%> + //登录者不是老师,且作业列表数目不为0,且作业处于开启匿评阶段 + var alert_model = "'#ajax-modal'"; + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_attach/praise_alert') %>'); + showModal('ajax-modal', '480px'); + $('#ajax-modal').css('height','240px'); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("width","511"); + $('#ajax-modal').parent().addClass("alert_praise"); + <% end %> + + <% unless @is_teacher%> + <% if @bid.comment_status == 0%> + $("#my_homework").click(); + <% elsif @bid.comment_status == 2%> + $("#all_homeworks").click(); + <% end %> + <% end %> + } + ); function hiddent_alert_model(){hideModal($('#popbox02'));} diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index ded8d5874..5421ed8d9 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -29,15 +29,15 @@ <% else %>
    • - <%= link_to "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> + <%= link_to "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'student_batch_homework',:remote => true}%>
    • - <%= link_to "我的作品", get_my_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> + <%= link_to "我的作品", get_my_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'my_homework',:remote => true}%>
    • <% if @bid.comment_status == 2 %>
    • - <%= link_to "所有作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%> + <%= link_to "所有作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {id: 'all_homeworks',:remote => true}%>
    • <% end %>
    • From 8fbbbe82e0fabc033e2a8c259aa032e7eb105d1d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 11:47:28 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=B7=A6=E4=B8=8A=E8=A7=92=E8=AF=BE=E7=A8=8B=E3=80=81=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 10bb25f78..69b7b6fc9 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -79,7 +79,7 @@
  • - <%= link_to course.name.to_s, homework_course_path(course) if course %> + <%= link_to "返回课程主页", homework_course_path(course) if course %>
    - <%=link_to(@bid.name, course_for_bid_path(@bid)) %> + + <%=link_to("第#{course.homeworks.index(@bid) + 1}次作业", course_for_bid_path(@bid)) %> +