From e7a1e9b325e7756297bfe632b782ef01accae738 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 14:23:24 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F=EF=BC=8C=E4=BD=BF=E5=85=B6=E4=BD=8D?= =?UTF-8?q?=E4=BA=8E=E5=B1=8F=E5=B9=95=E4=B8=AD=E9=97=B4=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework.html.erb | 4 +++- app/views/homework_attach/show.js.erb | 6 ++++-- public/stylesheets/css.css | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 458ed68cc..673ea2674 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -35,8 +35,10 @@ $('#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').before("" + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("width","511"); + $('#ajax-modal').parent().addClass("alert_praise"); <% end %> } diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb index 33cb3cc47..f22c5d149 100644 --- a/app/views/homework_attach/show.js.erb +++ b/app/views/homework_attach/show.js.erb @@ -1,9 +1,11 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>'); -showModal('ajax-modal', '503px'); +showModal('ajax-modal', '513px'); $('#ajax-modal').css('height','569px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + +$('#ajax-modal').before("" + ""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("alert_box"); diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 490dab1b7..a8fee8b67 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -69,7 +69,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} /****评分弹框****/ - +.alert_box {width:488px;height:550px;position:absolute;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } .alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(images/close.png) no-repeat;cursor:pointer;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; } @@ -143,6 +143,7 @@ a:hover.tijiao{ background:#0f99a9 !important;} .N_search{ height:20px !important; border:1px solid #999 !important;} /* 匿名评分弹框 */ +.alert_praise{width:480px;height:200px;position:absolute;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;} .alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;} .ni_con { width:425px; margin:25px 30px;} .ni_con h2{ display:block; height:40px; width:188px; margin:0 auto;} From 0f14fbef985f8a9badb210119d32394beb132034 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 14:53:49 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=9A=E4=BD=9C=E4=B8=9A=E6=80=BB=E6=95=B0=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?4=E4=BB=BD=E6=97=B6=E6=89=8D=E5=8F=AF=E4=BB=A5=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8C=BF=E8=AF=84=20=E5=A2=9E=E5=8A=A0=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E9=87=8D=E5=A4=8D=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 44 ++++++++++++------- app/views/bids/start_anonymous_comment.js.erb | 10 ++++- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 8eaf20716..000752d2b 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1004,27 +1004,37 @@ class BidsController < ApplicationController # 启动匿评 def start_anonymous_comment @bid = Bid.find(params[:id]) - homeworks = @bid.homeworks - users = homeworks.map { |h| h.user } - - @start_index = rand(homeworks.size) - while users[0] == homeworks[@start_index].user - @start_index = rand(homeworks.size) - end + if(@bid.comment_status == 1) + homeworks = @bid.homeworks + if(homeworks && homeworks.count >= 4) + @bid.update_column('comment_status', 1) + users = homeworks.map { |h| h.user } - 3.times do |i| - homework_start_index = @start_index + i - users.each_with_index do |user, index| - actual_index = homework_start_index + index - actual_index = (actual_index < homeworks.size ? actual_index : actual_index - homeworks.size) - if user != homeworks[actual_index] - @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: homeworks[actual_index].id) - @homework_evaluation.save + @start_index = rand(homeworks.size) + while users[0] == homeworks[@start_index].user + @start_index = rand(homeworks.size) end + + 3.times do |i| + homework_start_index = @start_index + i + users.each_with_index do |user, index| + actual_index = homework_start_index + index + actual_index = (actual_index < homeworks.size ? actual_index : actual_index - homeworks.size) + if user != homeworks[actual_index] + @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: homeworks[actual_index].id) + @homework_evaluation.save + end + end + end + # 修改状态为 '启动匿评' + #@bid.update_column('comment_status', 1) + @statue = 1 + else + @statue = 2 end + else + @statue = 3 end - # 修改状态为 '启动匿评' - @bid.update_column('comment_status', 1) respond_to do |format| format.js diff --git a/app/views/bids/start_anonymous_comment.js.erb b/app/views/bids/start_anonymous_comment.js.erb index 84cd65a7d..a6e24285b 100644 --- a/app/views/bids/start_anonymous_comment.js.erb +++ b/app/views/bids/start_anonymous_comment.js.erb @@ -1,2 +1,8 @@ -alert('启动成功') -$("#<%= @bid.id %>_start_anonymous_comment").html('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>') +<% if @statue == 1%> + alert('启动成功'); + $("#<%= @bid.id %>_start_anonymous_comment").html('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>'); +<% elsif @statue == 2 %> + alert('启动失败\n作业总数大于4份时才能启动匿评'); +<% elsif @statue == 3%> + alert("已开启匿评,请务重复开启"); +<% end %> From 334a99bcefcd1f85eab40a51bbcb3a2143560fbb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 15:41:10 +0800 Subject: [PATCH 3/8] =?UTF-8?q?1.=E5=8F=96=E6=B6=88=E8=80=81=E5=B8=88?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E6=97=B6=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=BA=92=E8=AF=84=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=202?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A=E6=94=B9=E4=B8=BA=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BD=9C=E4=B8=9A=203.=E4=BF=AE=E6=94=B9=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E8=AF=84=E5=88=86=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/controllers/bids_controller.rb | 2 +- app/views/bids/_homework_form.html.erb | 4 ++-- app/views/homework_attach/_homework.html.erb | 4 ++-- app/views/homework_attach/_homeworks_list.html.erb | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 000752d2b..cbe81c54f 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1004,7 +1004,7 @@ class BidsController < ApplicationController # 启动匿评 def start_anonymous_comment @bid = Bid.find(params[:id]) - if(@bid.comment_status == 1) + if(@bid.comment_status == 0) homeworks = @bid.homeworks if(homeworks && homeworks.count >= 4) @bid.update_column('comment_status', 1) diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 063daa12c..de4c16960 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -37,10 +37,10 @@
-+
-<%= f.select :proportion, proportion_option %>
diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index 63e398877..be83a93ae 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -78,7 +78,7 @@ <% if @bid.comment_status == 1 %>
+ | <%= link_to course.name.to_s, homework_course_path(course) if course %> @@ -85,7 +85,7 @@ | ||||||||
+ |
<%=link_to(@bid.name, course_for_bid_path(@bid)) %>
@@ -101,8 +101,25 @@
|