开启/关闭匿评弹框提示

This commit is contained in:
sw 2015-05-26 10:00:37 +08:00
parent e3379cf205
commit f3597d9aa5
7 changed files with 101 additions and 5 deletions

View File

@ -1,7 +1,7 @@
class HomeworkCommonController < ApplicationController class HomeworkCommonController < ApplicationController
layout "base_courses" layout "base_courses"
before_filter :find_course, :only => [:index,:new,:create] 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] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
def index def index
@ -135,6 +135,17 @@ class HomeworkCommonController < ApplicationController
#提示 #提示
def alert_anonymous_comment 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| respond_to do |format|
format.js format.js
end end

View File

@ -201,14 +201,13 @@ module CoursesHelper
end end
members members
end end
def searchStudent project def searchStudent project
#searchPeopleByRoles(project, StudentRoles) #searchPeopleByRoles(project, StudentRoles)
members = [] members = []
project.members.each do |m| project.members.each do |m|
if m && m.user && m.user.allowed_to?(:as_student,project) if m && m.user && m.user.allowed_to?(:as_student,project)
members << m members << m
end end
end end
members members

View File

@ -95,4 +95,15 @@ module HomeworkCommonHelper
end end
type type
end 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 end

View File

@ -0,0 +1,42 @@
<div id="popbox02">
<div class="ni_con">
<% if @homework_detail_manual.comment_status == 1%>
<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 @homework_detail_manual.comment_status == 2 %>
<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="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
取&nbsp;&nbsp;消
</a>
</div>
</div>
</div>

View File

@ -1 +1,7 @@
alert(1111); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' 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");

View File

@ -773,4 +773,19 @@ $(function(){
//alert($(this).html()); //alert($(this).html());
$(this).find("div").hide(); $(this).find("div").hide();
}); });
}); });
//匿评弹框取消按钮
function clickCanel(){hideModal("#popbox02");}
//匿评弹框确定按钮
function clickOK(path)
{
clickCanel();
$.ajax({
type: "GET",
url: path,
data: 'text',
success: function (data) {
}
});
}

View File

@ -288,6 +288,18 @@ a:hover.member_btn{ background:#329cbd;}
.ni_con p{ color:#808181;} .ni_con p{ color:#808181;}
.ni_con a:hover{ text-decoration:none;} .ni_con a:hover{ text-decoration:none;}
a.xls{ margin-left:5px; color:#136b3b;} 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_list{ width:670px;}
.st_search{ } .st_search{ }