diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 3aeb37101..3c2321ae2 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,7 +1,7 @@ class HomeworkCommonController < ApplicationController layout "base_courses" before_filter :find_course, :only => [:index,:new,:create] - before_filter :find_homework, :only => [:edit,:update] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] def index @@ -135,6 +135,17 @@ class HomeworkCommonController < ApplicationController #提示 def alert_anonymous_comment + @cur_size = 0 + @totle_size = 0 + if @homework_detail_manual.comment_status == 1 + @totle_size = @course.student.count + @cur_size = @homework.student_works.size + elsif @homework_detail_manual.comment_status == 2 + @homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count} + @cur_size = 0 + @homework.student_works.map { |work| @cur_size += work.student_works_scores.count} + end + @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) respond_to do |format| format.js end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8b13f507b..d0de1690a 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -201,14 +201,13 @@ module CoursesHelper end members end + def searchStudent project #searchPeopleByRoles(project, StudentRoles) members = [] - project.members.each do |m| if m && m.user && m.user.allowed_to?(:as_student,project) members << m - end end members diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index 3fcd0a890..4b9a44c07 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -95,4 +95,15 @@ module HomeworkCommonHelper end type end + + #根据传入作业确定跳转到开启匿评还是关闭匿评功能 + def alert_anonyoms_path homework,homework_detail_manual + link = "" + if homework_detail_manual.comment_status == 1 + link = start_anonymous_comment_homework_common_url homework.id + elsif homework_detail_manual.comment_status == 2 + link = stop_anonymous_comment_homework_common_url homework.id + end + link + end end \ No newline at end of file diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb new file mode 100644 index 000000000..3b199e0d8 --- /dev/null +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -0,0 +1,42 @@ +
+
+ <% if @homework_detail_manual.comment_status == 1%> +

开启匿评功能

+

+ 开启匿评后学生将不能对作品进行 + 修改、删除 + 等操作,目前有 + <%= @totle_size%>个 + 学生,共提交了 + <%= @cur_size %> + 份作品,占 + <%= @percent %>%, + 是否确定开启匿评? +

+ <% elsif @homework_detail_manual.comment_status == 2 %> +

关闭匿评功能

+

+ 关闭匿评后学生将不能对作品进行 + 匿评 + ,且作品列表将会 + 公开, + 目前分配了 + <%= @totle_size%>份 + 匿评作品,已评了 + <%= @cur_size %> + 份作品,占 + <%= @percent %>%, + 是否确定关闭匿评? +

+ <% end %> + +
+
+ diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb index f1f6527c1..2b3248dc2 100644 --- a/app/views/homework_common/alert_anonymous_comment.js.erb +++ b/app/views/homework_common/alert_anonymous_comment.js.erb @@ -1 +1,7 @@ -alert(1111); \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + +""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("anonymos"); \ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 63d20fefd..6eb213eef 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -773,4 +773,19 @@ $(function(){ //alert($(this).html()); $(this).find("div").hide(); }); -}); \ No newline at end of file +}); + +//匿评弹框取消按钮 +function clickCanel(){hideModal("#popbox02");} +//匿评弹框确定按钮 +function clickOK(path) +{ + clickCanel(); + $.ajax({ + type: "GET", + url: path, + data: 'text', + success: function (data) { + } + }); +} \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index e1d314c53..93a8da41f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -288,6 +288,18 @@ a:hover.member_btn{ background:#329cbd;} .ni_con p{ color:#808181;} .ni_con a:hover{ text-decoration:none;} a.xls{ margin-left:5px; color:#136b3b;} + +/* 开启匿评弹框 */ +.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} +.ni_con { width:425px; margin:25px 30px;} +.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;} +.ni_con p{ color:#808181; } +.ni_con a:hover{ text-decoration:none;} +.ni_btn{ width:190px; margin:15px auto; line-height:1.9;} +a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:15px;} +a:hover.tijiao{ background:#0f99a9;} +.c_pink{ color:#e65d5e;} + /* 学生列表*/ .st_list{ width:670px;} .st_search{ }