From 759d69892e145a841aed10aa40db87a17120abf2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 7 Nov 2014 10:37:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=B9=E5=87=BA=E6=A1=86?= =?UTF-8?q?=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/_alert_anonyoms.html.erb | 124 ++++++++++++++---- app/views/bids/alert_anonymous_comment.js.erb | 12 +- app/views/layouts/base_homework.html.erb | 11 +- 4 files changed, 112 insertions(+), 37 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 96dfc9b25..1de222c7c 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1066,7 +1066,7 @@ class BidsController < ApplicationController @cur_size = 0 @bid.homeworks.map { |homework| @cur_size += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count} end - @percent = format("%.2f",((@cur_size == 0 ? 1 : @cur_size) / @totle_size.to_f) * 100) + @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/views/bids/_alert_anonyoms.html.erb b/app/views/bids/_alert_anonyoms.html.erb index 6ce7845c8..456c9b2be 100644 --- a/app/views/bids/_alert_anonyoms.html.erb +++ b/app/views/bids/_alert_anonyoms.html.erb @@ -1,29 +1,97 @@ - - -
- <% if @bid.comment_status == 0%> -

- 目前<%= totle_size%>个学生,总共提交了<%= cur_size %>份作业,占<%= percent %> -

- <% elsif @bid.comment_status == 1%> -

- 目前总共分配了目前总共分配了<%= totle_size%>份匿评作业,已评价<%= cur_size %>份作业,占<%= percent %> -

- <% end %> - 确定 - 取消 + + + + 开启匿评功能 + + + + + + +
+
+
+ + +
+
+ +
+ <% if @bid.comment_status == 0%> +

开启匿评功能

+

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

+ <% elsif @bid.comment_status == 1 %> +

关闭匿评功能

+

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

+ <% end %> + +
+ + + diff --git a/app/views/bids/alert_anonymous_comment.js.erb b/app/views/bids/alert_anonymous_comment.js.erb index 0f227727b..2ec98fcc2 100644 --- a/app/views/bids/alert_anonymous_comment.js.erb +++ b/app/views/bids/alert_anonymous_comment.js.erb @@ -1,10 +1,8 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>'); -showModal('ajax-modal', '513px'); -$('#ajax-modal').css('height','569px'); +showModal('ajax-modal', '500px'); +$('#ajax-modal').css('height','180px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); +$('#ajax-modal').before("" + + ""); $('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file +$('#ajax-modal').parent().addClass("anonymos"); \ No newline at end of file diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 69b7b6fc9..79d6fb9c8 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -106,7 +106,16 @@ <% if (User.current.admin?||User.current.id==@bid.author_id) %> - <%= anonymous_comment_link(@bid, course) %> + + <% case bid.comment_status %> + <% when 0 %> + <%= link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %> + <% when 1 %> + <%= link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true %> + <% when 2 %> + 匿评结束 + <% end %> + <% end %>