Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework
This commit is contained in:
commit
c68e68af96
|
@ -1040,6 +1040,33 @@ class BidsController < ApplicationController
|
|||
|
||||
@bid.update_column('comment_status', 2)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def alert_anonymous_comment
|
||||
@bid = Bid.find params[:id]
|
||||
@course = @bid.courses.first
|
||||
if @bid.comment_status == 0
|
||||
@totle_size = searchStudent(@course).size
|
||||
@cur_size = @bid.homeworks.size
|
||||
elsif @bid.comment_status == 1
|
||||
@totle_size = 0
|
||||
@bid.homeworks.map { |homework| @totle_size += homework.homework_evaluations.count}
|
||||
teachers = "("
|
||||
teacher_members = searchTeacherAndAssistant(@course)
|
||||
teacher_members.each do |member|
|
||||
if member == teacher_members.last
|
||||
teachers += member.user_id.to_s + ")"
|
||||
else
|
||||
teachers += member.user_id.to_s + ","
|
||||
end
|
||||
end
|
||||
@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.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -1084,6 +1111,5 @@ class BidsController < ApplicationController
|
|||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1931,7 +1931,7 @@ module ApplicationHelper
|
|||
when 0
|
||||
@student_size ||= searchStudent(course).size
|
||||
@homework_size = bid.homeworks.size
|
||||
percent = @homework_size.to_f / @student_size
|
||||
percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
|
||||
confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
||||
when 1
|
||||
@homework_evaluations = 0
|
||||
|
@ -1948,7 +1948,7 @@ module ApplicationHelper
|
|||
@has_evaluations = 0
|
||||
bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
|
||||
|
||||
percent = @has_evaluations.to_f / @homework_evaluations
|
||||
percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
|
||||
confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作业,已评价#{@has_evaluations}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
||||
end
|
||||
confirm_info
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>开启匿评功能</title>
|
||||
<style>
|
||||
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;}
|
||||
div,img,tr,td,textarea{ border:0;}
|
||||
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||
ul,li{ list-style-type:none}
|
||||
.cl{ clear:both; overflow:hidden; }
|
||||
a{ text-decoration:none; }
|
||||
a:hover{ text-decoration:underline;}
|
||||
|
||||
|
||||
/* 匿名评分弹框 */
|
||||
.anonymos{width:480px;height:180px;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;}
|
||||
.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; }
|
||||
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_blue{ color:#0195bd;}
|
||||
.c_pink{ color:#e65d5e;}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
function clickOK()
|
||||
{
|
||||
hideModal("#popbox02");
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "<%= bid.comment_status == 0 ? start_anonymous_comment_bid_path(bid) : stop_anonymous_comment_bid_path(bid)%>",
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<% if @bid.comment_status == 0%>
|
||||
<h2>开启匿评功能</h2>
|
||||
<p>
|
||||
开启匿评后学生将不能对作业进行
|
||||
<span class="c_blue">提交、修改、删除</span>
|
||||
等操作,目前有
|
||||
<span class="c_pink"><%= totle_size%>个</span>
|
||||
学生,共提交了
|
||||
<span class="c_pink"><%= cur_size %></span>
|
||||
份作业,占
|
||||
<span class="c_pink"><%= percent %>%</span>,
|
||||
是否确定开启匿评?
|
||||
</p>
|
||||
<% elsif @bid.comment_status == 1 %>
|
||||
<h2>关闭匿评功能</h2>
|
||||
<p>
|
||||
关闭匿评后学生将不能对作业进行
|
||||
<span class="c_blue">匿评</span>
|
||||
,且作业列表将会
|
||||
<span class="c_blue">公开</span>,
|
||||
目前分配了
|
||||
<span class="c_pink"><%= totle_size%>份</span>
|
||||
匿评作业,已评了
|
||||
<span class="c_pink"><%= cur_size %></span>
|
||||
份作业,占
|
||||
<span class="c_pink"><%= percent %>%</span>,
|
||||
是否确定关闭匿评?
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="ni_btn">
|
||||
<a href="#" class="tijiao" onclick="clickOK();" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="#" class="tijiao" onclick="clickCanel();">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -34,7 +34,16 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% if (User.current.admin?||User.current.id==bid.author_id) %>
|
||||
<%= anonymous_comment_link(bid, @course) %>
|
||||
<span id="<%=bid.id %>_anonymous_comment">
|
||||
<% 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 %>
|
||||
</span>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id},
|
||||
|
|
|
@ -0,0 +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', '500px');
|
||||
$('#ajax-modal').css('height','180px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
|
@ -1,8 +1,7 @@
|
|||
<% 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, id:"#{@bid.id}_stop_anonymous_comment" %>');
|
||||
$("#<%= @bid.id%>_stop_anonymous_comment").attr("data-confirm","关闭匿评后学生将不能对作业进行评分,且学生作业列表将会被公开\n是否确定关闭匿评?");
|
||||
$("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", alert_anonymous_comment_bid_path(@bid), remote: true, id:"#{@bid.id}_stop_anonymous_comment" %>');
|
||||
<% elsif @statue == 2 %>
|
||||
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
|
||||
<% elsif @statue == 3%>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
alert('关闭成功')
|
||||
$("#<%= @bid.id %>_anonymous_comment").html('已关闭匿评')
|
||||
alert('关闭成功');
|
||||
$("#<%= @bid.id %>_anonymous_comment").html('匿评结束');
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="add_frame_header" >
|
||||
<%= l(:label_message_new) %>
|
||||
</div>
|
||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
||||
<p>
|
||||
<input type="button" onclick="submitCoursesBoard();" class = "whiteButton m3p10 h30" value="<%= l(:button_submit)%>">
|
||||
|
|
|
@ -106,7 +106,16 @@
|
|||
<% if (User.current.admin?||User.current.id==@bid.author_id) %>
|
||||
<tr>
|
||||
<td valign="top" style="padding-left: 8px; font-size: 15px" colspan="2">
|
||||
<%= anonymous_comment_link(@bid, course) %>
|
||||
<span id="<%=@bid.id %>_anonymous_comment">
|
||||
<% 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 %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -603,7 +603,7 @@ zh:
|
|||
#by young
|
||||
label_requirement: 需求
|
||||
label_new_course: 课程列表
|
||||
label_course_practice: 课程实践
|
||||
label_course_practice: 课程作业
|
||||
label_course_all: 课程列表
|
||||
label_teacher_all: 所有教师
|
||||
label_project_deposit: 项目托管
|
||||
|
|
|
@ -331,6 +331,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'homework_ajax_modal'
|
||||
get 'start_anonymous_comment', as: 'start_anonymous_comment'
|
||||
get 'stop_anonymous_comment', as: 'stop_anonymous_comment'
|
||||
get 'alert_anonymous_comment'
|
||||
end
|
||||
end
|
||||
resources :projects do
|
||||
|
|
Loading…
Reference in New Issue