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 @@
- <%= 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) %> + |
- <%= 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),{} %> |
-
- <%= l(:text_command) %> + + <%= l(:text_command) %> + <% end %>
<%= 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| %>