This commit is contained in:
huang 2015-01-17 14:04:32 +08:00
commit e5da3c47ed
5 changed files with 80 additions and 81 deletions

View File

@ -7,7 +7,11 @@ class PollController < ApplicationController
def index
if @course
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
if @is_teacher
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
else
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
end
@polls = paginateHelper polls,10 #分页
respond_to do |format|
format.html{render :layout => 'base_courses'}

View File

@ -58,13 +58,14 @@
function poll_submit()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { poll: @poll}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').css('height','180px');
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','100px');
$('#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().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
$('#ajax-modal').parent().addClass("popbox_polls");
}
</script>
</head>

View File

@ -1,28 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>开启匿评功能</title>
<style>
#popbox02{ font-size:12px; font-family:"微软雅黑","宋体"; background:#fff; font-style:normal;}
#popbox02 div,img,tr,td,textarea{ border:0;}
#popbox02 table,tr,td{border:0; cellspacing:0; cellpadding:0;}
#popbox02 ul,li{ list-style-type:none}
#popbox02 .cl{ clear:both; overflow:hidden; }
#popbox02 a{ text-decoration:none; }
#popbox02 a:hover{ text-decoration:underline;}
/* 问卷发布弹框 */
.anonymos{width:480px;height:180px;position:fixed;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_blue{ color:#0195bd;}
.c_pink{ color:#e65d5e;}
</style>
<script type="text/javascript">
function clickPublishPoll()
{
@ -42,21 +20,23 @@
<body>
<div id="popbox02">
<div class="ni_con">
<h2>问卷发布</h2>
<p style="text-align: center">
问卷发布后将无法
<span class="c_blue">修改</span>
<br/>
是否确定发布该问卷?
</p>
<div class="ni_btn">
<%= link_to "确 定",publish_poll_poll_path(poll.id), :class => "tijiao", :onclick => "clickCanel();" %>
<a href="#" class="tijiao" onclick="clickCanel();">
取&nbsp;&nbsp;消
</a>
<div class="upload_con">
<div class="upload_box">
<p class="polls_box_p">问卷发布后将不能对问卷进行修改,
<br />
是否确定发布该问卷?
</p>
<div class="polls_btn_box">
<%= link_to "确 定",publish_poll_poll_path(poll.id), :class => "upload_btn", :onclick => "clickCanel();" %>
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
取&nbsp;&nbsp;消
</a>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</body>
</html>

View File

@ -11,46 +11,46 @@
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<% unless !@is_teacher && poll.polls_status != 2 %>
<ul id="polls_<%= poll.id %>">
<li>
<% if @is_teacher %>
<% if has_commit_poll?(poll.id ,User.current) %>
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
<% else %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
<ul id="polls_<%= poll.id %>">
<li title="<%= poll.polls_name %>">
<% if @is_teacher %>
<% if has_commit_poll?(poll.id ,User.current) %>
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
<% else %>
<% if has_commit_poll?(poll.id ,User.current) && poll.polls_status == 2 %>
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
<% elsif (!has_commit_poll?(poll.id ,User.current)) && poll.polls_status == 2 %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
</li>
<li>
<%if @is_teacher%>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
<% end%>
</li>
<li>
<% if @is_teacher && poll.polls_status == 1 #新建状态的问卷可删除%>
<%= link_to(l(:button_delete), poll,
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
<% end%>
</li>
<li>
<% if @is_teacher && poll.polls_status == 1 #新建状态的问卷可编辑%>
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
<% end%>
</li>
<li class="polls_date fr">
<%= format_time poll.created_at%>
</li>
</ul>
<% end %>
<% else %>
<% if has_commit_poll?(poll.id ,User.current) && poll.polls_status == 2 %>
<sapn class="polls_title fl" >
<%= poll.polls_name %>
</sapn>
<% elsif (!has_commit_poll?(poll.id ,User.current)) && poll.polls_status == 2 %>
<%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<% end %>
<% end %>
</li>
<li>
<%if @is_teacher && poll.polls_status == 2%>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
<% end%>
</li>
<li>
<% if @is_teacher %>
<!--新建状态的问卷可删除-->
<%= link_to(l(:button_delete), poll,
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
<% end%>
</li>
<li>
<% if @is_teacher && poll.polls_status == 1%>
<!--新建状态的问卷可编辑-->
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
<% end%>
</li>
<li class="polls_date fr">
<%= format_time poll.created_at%>
</li>
</ul>
<div class="cl"></div>
<% end%>

View File

@ -26,7 +26,7 @@ div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margi
a.newbtn{ float:right; display:block; width:80px; height:30px; background:#64bdd9; color:#fff; font-size:14px; margin:10px; text-align:center;}
a:hover.newbtn{ background:#55a1b9; text-decoration:none;}
.polls_list ul{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:32px; padding-top:8px;}
a.polls_title{ font-weight:bold; color:#3e6d8e;}
a.polls_title{ font-weight:bold; color:#3e6d8e;max-width: 350px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.polls_title{ font-weight:bold; color:#3e6d8e;}
a.pollsbtn{ display:block; width:66px; height:22px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;}
a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
@ -42,15 +42,15 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
/*问卷页面*/
.polls_box{ border:1px solid #dcdcdc; padding:15px 30px;}
.ur_page_title{ font-size:16px; text-align:center; color:#353535;}
.ur_page_title{ font-size:16px; text-align:center; color:#353535;word-break: break-all; word-wrap: break-word;}
.ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; }
.ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;}
.ur_title{ padding:20px 0px ; float:left; width:604px; }
.ur_title{ padding:20px 0px ; float:left; width:604px; word-break: break-all; word-wrap: break-word;}
.ur_required{ font-weight: bold; color:red;}
.ur_inputs{ color:#666;}
.ur_table{border-top:1px solid #dcdcdc;}
.ur_inputs tr td{ height:40px;border-bottom:1px solid #dcdcdc; width:617px;}
.ur_inputs label{ padding-left:10px;}
.ur_inputs label{ padding-left:10px;word-break: break-all; word-wrap: break-word;}
.ur_inputs input{ margin-right:5px;}
.ur_text{ height:30px;}
.ur_textbox{ border:1px solid #dcdcdc !important; color:#676765;}
@ -120,3 +120,17 @@ a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px;
a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;}
.ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;}
/***弹框***/
.popbox_polls{width:300px;height:100px;position:fixed;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; 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:-310px;background:url(/images/bid/close.png) no-repeat;cursor:pointer;}
.upload_box{ width:270px; margin:15px auto;}
.polls_box_p{ font-size:14px; text-align:center;}
a.upload_btn{ display:block; float:left; margin:15px 0 5px; width:60px; padding: 7px 0; text-align: center; color:#fff; font-size:14px; background:#15bccf; margin-right:10px;}
a:hover.upload_btn{ background:#06a9bc;}
a.upload_btn_grey{background:#a3a3a3;}
a:hover.upload_btn_grey{background:#8a8a8a;}
.upload_con p{ color:#808181;}
.upload_con a:hover{ text-decoration:none;}
.polls_btn_box{ width:145px; margin:0 auto; padding-left:10px;}
.polls_btn_box02{ width:80px; margin:0 auto; padding-left:10px;}