From 5f1b4b1b24a53f0f78a07bd554ae96cbed2318e0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 14:16:12 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=90=8E=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE=E3=80=81=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E6=A1=86=E7=A1=AE=E5=AE=9A=E6=8C=89=E9=92=AE=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/homework.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index d897ba5e9..ad3ad02fe 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -115,7 +115,7 @@ $(function(){ minWidth: 753 }); - $('a.ProBtn').on('click', function(){ + $('a.ProBtn').live('click', function(){ $("#BluePopupBox").dialog("open"); $(".ui-dialog-titlebar").hide(); $("a.CloseBtn").on('click', function(){ @@ -173,7 +173,7 @@ $(function(){ return valid; } - $("#BluePopupBox a.BlueCirBtn").on('click', function(){ + $("#BluePopupBox a.BlueCirBtn").live('click', function(){ if(saveProgramAnswers()){ if($( "#BluePopupBox" ).dialog( "isOpen" )){ $("#BluePopupBox").dialog( "close" ); From 709e09977068e92bab2b67adb5dfe27e0e16861d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 14:33:33 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=85=B3=E8=81=94=E8=A1=A8=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 6 +++--- app/helpers/api_helper.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/views/users/_user_homework_list.html.erb | 9 ++++++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 90a0f3ed6..2d7bf02b1 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -75,7 +75,7 @@ class StudentWorkController < ApplicationController @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @homework_commons = @course.homework_commons.order("created_at desc") @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - @is_evaluation = @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 + @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 @show_all = false course_group = CourseGroup.find_by_id(@group) if @group @@ -86,7 +86,7 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - if @is_teacher #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 @@ -106,7 +106,7 @@ class StudentWorkController < ApplicationController @stundet_works = [] end else - if @is_teacher #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index f26f5c19b..f73cc87e6 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -75,7 +75,7 @@ module ApiHelper # 学生获取课程作业的状态 def get_homework_status homework homework_status = "" - if !homework.nil? + if homework if homework.homework_type == 1 && homework.homework_detail_manual case homework.homework_detail_manual.comment_status when 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cfb655baa..f0ebf8a82 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2299,7 +2299,7 @@ module ApplicationHelper def homework_anonymous_comment homework if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" - elsif homework.student_works.count >= 2 #作业份数大于2 + elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 case homework.homework_detail_manual.comment_status when 1 link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 89800b768..f7017deab 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -14,12 +14,15 @@ - <% if homework_common.homework_detail_manual.comment_status == 1%> + + <% if homework_common.homework_detail_manual%> + <% if homework_common.homework_detail_manual.comment_status == 1%> 未开启匿评 - <% elsif homework_common.homework_detail_manual.comment_status == 2%> + <% elsif homework_common.homework_detail_manual.comment_status == 2%> 匿评中 - <% elsif homework_common.homework_detail_manual.comment_status == 3%> + <% elsif homework_common.homework_detail_manual.comment_status == 3%> 匿评已结束 + <% end%> <% end%>
From 29fd5b41e212487ab6be934a62f7272ec15e5944 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 14:55:58 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/search.html.erb | 156 ++++++++++++++------------------ 1 file changed, 66 insertions(+), 90 deletions(-) diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index a8401c406..f5287cbd4 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -1,94 +1,70 @@ - + function searchByChange() + { + $("#search_by_input").val($("#search_by").val()); + } + -
- <%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %> - - - - - - - - - - -
- <%= l(:label_software_user ) %> - - <%= l(:label_user_location) %> : - - - - - - - - - - -
- <%=link_to l(:field_homepage), home_path %> > - <%= l(:label_software_user)%> -
-
-<% end %> - - -
- <% if @users.size > 0 %> - <%= render :partial => 'user_show' %> - - - <% else %> - <%= render :partial => "layouts/no_content"%> - <% end %> -
- -<% html_title(l(:label_user_plural)) -%> + <% end %> + + +
+ <% if @users.size > 0 %> + <%= render :partial => 'user_show' %> + <% else %> + <%= render :partial => "layouts/no_content"%> + <% end %> +
+ +
+
+ <% html_title(l(:label_user_plural)) -%> +
+
+ + + + From 4a838611fde69b41f4c06744d5af5b43f3887096 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 15:01:24 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=AF=BE=E7=A8=8B=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=E6=8C=89=E6=97=B6=E9=97=B4=E5=80=92=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index b1020d938..4923c629e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -582,7 +582,7 @@ module UsersHelper option << "请选择发布作业的课程" option << -1 type << option - user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| + user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| option = [] option << course.name+"("+course.time.to_s+course.term+")" option << course.id From 33924680b2dbbbbb4e90be6d575a7d1172b1a3fb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Sep 2015 15:02:56 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f0ebf8a82..41e016562 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2309,7 +2309,7 @@ module ApplicationHelper # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end else - link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评" + link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评" end link end From e15ea06e2a056c250003e1e267263f5fabbffb2f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 25 Sep 2015 15:08:31 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 07b2a345c..b820e6d54 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -71,7 +71,7 @@ class Mailer < ActionMailer::Base recipients ||= [] course.student.each do |student| user = User.find(student.student_id) - @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" @token = Token.get_token_from_user(user, 'autologin') @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @anonymous_comment_close_name = homework_common.name @@ -255,7 +255,7 @@ class Mailer < ActionMailer::Base # 作业截止时间邮件提醒 def homework_endtime__added(homework_common, user_id) user = User.find(user_id) - @subject = "#{l(:mail_homework)}#{homework_common.name}#{l(:mail_homework_endtime)} " + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} " @token = Token.get_token_from_user(user, 'autologin') @homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @homework_endtime_name = homework_common.name