班级问卷列表样式调整

This commit is contained in:
cxt 2016-12-02 14:53:20 +08:00
parent 2fd4cb9064
commit adac1d3d7a
13 changed files with 111 additions and 74 deletions

View File

@ -270,6 +270,7 @@ class PollController < ApplicationController
#发布问卷
def publish_poll
@index = params[:index]
@poll.polls_status = 2
@poll.published_at = Time.now
@poll.show_result = params[:show_result].to_i if params[:show_result]
@ -508,6 +509,7 @@ class PollController < ApplicationController
#重新发布问卷
def republish_poll
@index = params[:index]
@poll.poll_questions.each do |poll_question|
poll_question.poll_votes.destroy_all
end
@ -530,6 +532,7 @@ class PollController < ApplicationController
#关闭问卷
def close_poll
@index = params[:index]
@poll.polls_status = 3
@poll.closed_at = Time.now
if @poll.save

View File

@ -36,7 +36,7 @@
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
<% if @is_teacher && exercise.exercise_status > 1 %>
<% if exercise.exercise_status > 1 %>
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
<% end %>

View File

@ -1,68 +1,93 @@
<% has_commit = has_commit_poll?(poll.id ,User.current)%>
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<% if @is_teacher%>
<li title="<%= poll.polls_name %>">
<div style="width: 310px;float: left;">
<% if has_commit %>
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<% else %>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<% end %>
<div>
<div title="<%= poll_name %>">
<div style="width: 600px;float: left;">
<% if has_commit %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% else %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% end %>
<% if poll.polls_status == 1 %>
<span class="exercise_status_nop fl mt3"></span>
<% elsif poll.polls_status == 2 %>
<span class="exercise_status_pub fl mt3"></span>
<% else %>
<span class="exercise_status_end fl mt3"></span>
<% end%>
</div>
</div>
<div id="exercise_opr_<%=poll.id %>" class="none fr">
<a href="javascript:void(0)" onClick="delete_exercise(<%=poll.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
<% if poll.polls_status == 1 %>
<%= link_to '', edit_poll_path(poll.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
<% end%>
</div>
</div>
</li>
<div class="cl"></div>
<% if poll.polls_status == 1%>
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%></li>
<% end%>
<div class="mt10">
<span class="c_grey fl mr15">创建时间:<%= format_time(poll.created_at) %></span>
<% if poll.polls_status > 1 %>
<span class="c_grey fl mr15">发布时间:<%= poll.published_at.nil? ? '未设置' : format_time(poll.published_at) %></span>
<% end %>
<% if poll.polls_status > 1 %>
<span class="c_grey fl mr15">答题:<span class="c_blue" title="已答学生数/未答学生数"><%= poll.poll_users.count %> / <%=@course.student.count %></span></span>
<% end %>
<% if poll.polls_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>);">发布问卷</a></li>
<% elsif poll.polls_status == 2%>
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_poll(<%= poll.id%>);">取消发布</a></li>
<% else%>
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布问卷</li>
<% end%>
<% if poll.polls_status == 1 %>
<div><a href="javascript:" class="pollsbtn btn_pu fr ml10" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>,<%= index%>);">发布问卷</a></div>
<% elsif poll.polls_status == 2%>
<div><a href="javascript:" class="pollsbtn btn_de fr ml10" onclick="republish_poll(<%= poll.id%>, <%=index %>);">取消发布</a></div>
<% else%>
<div class="pollsbtn fr ml10 pollsbtn_grey ml10">发布问卷</div>
<% end%>
<%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
<% if poll.polls_status == 1%>
<div class="pollsbtn fr ml10 pollsbtn_grey">统计结果</div>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<div><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr ml10"%></div>
<% end%>
<% if poll.polls_status == 1 %>
<li><%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%></li>
<% else%>
<li class="polls_de_grey fr ml5" title="未发布的问卷才能进行编辑">编辑</li>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="pollsbtn fr ml10" onclick="close_poll(<%= poll.id%>, <%=index %>);" href="javascript:">关闭</a></li>
<% else %>
<li class="pollsbtn fr ml10 pollsbtn_grey" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="polls_de fr ml5" onclick="close_poll(<%= poll.id%>);" href="javascript:">关闭</a></li>
<% else %>
<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<% if poll.polls_status == 1%>
<li class="polls_de_grey fr ml5">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%></li>
<% end%>
<li class="polls_date fr"><%= format_date poll.created_at.to_date%></li>
<% if poll.polls_status == 1%>
<li class="pollsbtn fr ml10 pollsbtn_grey">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "pollsbtn fr ml10"%></li>
<% end%>
<div class="clear"></div>
</div>
<% else%>
<% if poll.polls_status == 2%>
<% if has_commit%>
<li><%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
<li class="pollsbtn_tip fl ml5">已答</li>
<%else%>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue"%>
<%end%>
<div>
<% if has_commit%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_com fl ml5"></span>
<%else%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_nocom fl ml5"></span>
<%end%>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">发布时间:<%= format_time(poll.published_at) %></span>
<span class="c_grey fl mr15">答题:<span class="c_blue" title="已答学生数/未答学生数"><%= poll.poll_users.count %> / <%=@course.student.count %></span></span>
<% if poll.show_result == 1 %>
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr"%></li>
<%else%>
<li class="pollsbtn fr pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
<%end%>
<% end %>
<div class="clear"></div>
</div>
<% end%>
<li class="polls_date fr mr10"><%= format_date poll.created_at.to_date%></li>
<% if poll.show_result == 1 %>
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%></li>
<%else%>
<li class="pollsbtn fr mr10 pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
<%end%>
<% end %>
<% end%>

View File

@ -1,4 +1,4 @@
<div class="polls_head">
<div class="polls_head" style="width:730px;">
<h2>所有问卷
<span><%= @obj_count%></span>
</h2>

View File

@ -1,6 +1,6 @@
<% polls.each do |poll|%>
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
<% polls.each_with_index do |poll, i|%>
<ul id="polls_<%= poll.id %>" class="exercise_list_div" onmouseover="$('#exercise_opr_<%=poll.id %>').show();" onmouseout="$('#exercise_opr_<%=poll.id %>').hide();">
<%= render :partial => 'poll', :locals => {:poll => poll, :index => i} %>
</ul>
<div class="cl"></div>
<% end%>

View File

@ -1,2 +1,2 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>");
alert("关闭成功");

View File

@ -1 +1,2 @@
hideModal();
$("#polls").html("<%= escape_javascript(render :partial => 'poll_list') %>");

View File

@ -1,13 +1,13 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript">
function republish_poll(poll_id)
function republish_poll(poll_id, index)
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/republish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a href='/poll/"+ poll_id +"/republish_poll?index=" + index +"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
@ -26,7 +26,7 @@
function clickCanel(){hideModal("#popbox02");}
function poll_submit(poll_id,poll_name)
function poll_submit(poll_id,poll_name,index)
{
if(poll_name == 0)
{
@ -39,7 +39,7 @@
"<div class='upload_box'>" +
"<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/publish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a href='/poll/"+ poll_id +"/publish_poll?index=" + index + "' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
@ -57,14 +57,14 @@
}
}
function close_poll(poll_id)
function close_poll(poll_id, index)
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>问卷关闭后学生将不能继续提交问卷,<br />是否确定关闭该问卷?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/close_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a href='/poll/"+ poll_id +"/close_poll?index=" + index +"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
@ -81,13 +81,20 @@
$('#ajax-modal').parent().addClass("popbox_polls");
}
function delete_exercise(id){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您是否确定删除</p><div class="cl"></div><a href="/poll/'+ id +'" class="fr sy_btn_blue mr90 mt10" data-method="delete" data-remote="true">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
</script>
<div class="courseRSide fl">
<div class="polls_content02" id="polls">
<div id="polls">
<%= render :partial => 'poll_list'%>
</div><!--问卷内容end-->
</div>

View File

@ -1,4 +1,4 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','111px');

View File

@ -1,4 +1,4 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','80px');

View File

@ -183,6 +183,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mw380 {max-width: 380px !important;}
.mw400 {max-width: 400px !important;}
.mw450 {max-width: 450px !important;}
.mw550 {max-width: 550px !important;}
.mt-20 {margin-top:-20px;}
.mt-10 {margin-top:-10px;}
.mt-4 {margin-top:-4px;}

View File

@ -594,9 +594,9 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.exercise_status_end{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -659px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_com{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -681px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_nocom{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -705px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;}
a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:25px; display:block;float:right;}
a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;}
.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;}
.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:25px; display:block;float:right; margin-right:10px;}
a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;}
/*首页课程列表归档按钮提示*/

View File

@ -15,7 +15,7 @@ a.newbtn{ float:right; display:block; width:80px; height:27px; padding-top:3px;
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; margin-top:3px;}
a.pollsbtn{ display:block; width:66px; height:20px; padding-top:2px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;}
a.pollsbtn{ display:block; height:20px; padding:0 9px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;}
a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
.polls_date{ color:#666666;margin-top:3px; }
.polls_de{ color:#6883b6; margin-top:3px;}
@ -129,7 +129,7 @@ a.btn_de{ border:1px solid #ff5d31; color:#ff5d31; }
a:hover.btn_de{ background:#ff5d31;}
a.btn_pu{ border:1px solid #3cb761; color:#3cb761; }
a:hover.btn_pu{ background:#3cb761;}
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; }
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:20px;}
.polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.polls_title_st { max-width:450px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.polls_de_grey{ color:#b1b1b1; margin-top:3px;}