修改弹出框样式

This commit is contained in:
sw 2014-11-07 10:37:10 +08:00
parent be500eb0d2
commit 759d69892e
4 changed files with 110 additions and 35 deletions

View File

@ -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

View File

@ -1,29 +1,97 @@
<script type="text/javascript">
function clickOK()
{
hideModal("#alert_div");
$.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) {
<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;}
}
});
}
function clickCanel(){hideModal("#alert_div");}
</script>
<div id="alert_div">
<% if @bid.comment_status == 0%>
<p>
目前<%= totle_size%>个学生,总共提交了<%= cur_size %>份作业,占<%= percent %>
</p>
<% elsif @bid.comment_status == 1%>
<p>
目前总共分配了目前总共分配了<%= totle_size%>份匿评作业,已评价<%= cur_size %>份作业,占<%= percent %>
</p>
<% end %>
<a onclick="clickOK();">确定</a>
<a onclick="clickCanel();">取消</a>
/* 匿名评分弹框 */
.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="alert" style="position: fixed;">
<div>
<span class="close02" style="display: block;" onclick="pupclose()"></span>
</div>
</div> <!---- alert end---->
<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();" >
确&nbsp;&nbsp;定
</a>
<a href="#" class="tijiao" onclick="clickCanel();">
取&nbsp;&nbsp;消
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -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("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_homework_atert_form("+
<%= @cur_page%> + "," + <%= @cur_type%> +
");'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#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("alert_box");
$('#ajax-modal').parent().addClass("anonymos");

View File

@ -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 %>