修改poll的show界面的样式

This commit is contained in:
sw 2015-03-24 16:26:54 +08:00
parent 25b3772520
commit 273e82f620
3 changed files with 69 additions and 84 deletions

View File

@ -1,97 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%= l(:label_poll_title) %></title>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<style type="text/css">
.alert_box{width:480px;height:180px;position:fixed;z-index:100;left:55%;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;}
.commit{
height: 28px;
display: block;
width: 80px;
color: #fff !important;
background: #15bccf;
text-align: center;
padding-top: 4px;
margin-left: 130px;
margin-top: 4px;
margin-right: 10px;
}
</style>
<script type="text/javascript">
function hidden_atert_form(cur_page,cur_type)
{
hideModal($("#popbox"));
}
</script>
</head>
<body>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<div class="polls_content polls_box" id="polls">
<div class="ur_page_head" >
<h1 class="ur_page_title">
<%= @poll.polls_name%>
</h1>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<p class="ur_prefix_content">
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
</p>
</div>
<div class="ur_card">
<ol class="ur_questions">
<% @poll_questions.each do |pq| %>
<% if pq.question_type == 1 %>
<!-- 单选题 -->
<% if pq.question_type == 1 %>
<!-- 单选题 -->
<li class="ur_question_item radio">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<span class="title_index">[单选题]</span>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<form>
<table class="ur_table" >
<tbody>
<table class="ur_table" >
<tbody>
<% pq.poll_answers.each do |pa| %>
<tr>
<td>
<label >
<script>
function click_<%= pa.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_answer_id: <%= pa.id %>,
poll_question_id: <%= pq.id %>
},
success: function (data) {
var dataObj = eval(data);
obj.checked = true;
var span = $('#percent');
span.html(dataObj.percent);
}
});
}
</script>
<%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current),:disabled => !@can_edit_poll %>
<%= pa.answer_text %>
</label>
</td>
</tr>
<tr>
<td>
<label >
<script>
function click_<%= pa.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_answer_id: <%= pa.id %>,
poll_question_id: <%= pq.id %>
},
success: function (data) {
var dataObj = eval(data);
obj.checked = true;
var span = $('#percent');
span.html(dataObj.percent);
}
});
}
</script>
<%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current),:disabled => !@can_edit_poll %>
<%= pa.answer_text %>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</tbody>
</table>
</form>
</div>
</li>
<% elsif pq.question_type == 2 %>
<!-- 多选题 -->
<% elsif pq.question_type == 2 %>
<!-- 多选题 -->
<li class="ur_question_item checkbox">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
@ -106,7 +78,7 @@
<form>
<table class="ur_table" >
<tbody>
<% pq.poll_answers.each do |pa| %>
<% pq.poll_answers.each do |pa| %>
<tr>
<td>
<label >
@ -141,14 +113,14 @@
</label>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</form>
</div>
</li>
<% elsif pq.question_type == 3 %>
<!-- 单行文字-->
<!-- 单行文字-->
<li class="ur_question_item text">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
@ -185,7 +157,7 @@
</div>
</li><!--单行输入 end-->
<% elsif pq.question_type == 4 %>
<!-- 多行文字-->
<!-- 多行文字-->
<li class="ur_question_item textarea">
<div class="ur_preview">
<div class="ur_title">
@ -212,8 +184,8 @@
var dataObj = eval(data);
if(dataObj.text != 'failure')
{
var span = $('#percent');
span.html(dataObj.percent);
var span = $('#percent');
span.html(dataObj.percent);
}
else
{
@ -229,8 +201,8 @@
</div>
</li><!--多行输入 end-->
<% else %>
<!-- 未知题型 -->
<% end %>
<!-- 未知题型 -->
<% end %>
<% end %>
</ol>
<ul class="wlist">
@ -239,16 +211,15 @@
<div class="cl"></div>
<div class="ur_buttons" style="width: 100px;">
<% if @poll.polls_status == 2 %>
<%= link_to l(:button_submit),commit_poll_poll_path(@poll), :method => :post,:class => "ur_button",:format => 'js',:remote=>true %>
<%= link_to l(:button_submit),commit_poll_poll_path(@poll), :method => :post,:class => "ur_button",:format => 'js',:remote=>true %>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_progress_text"><%= l(:label_complete_question) %> <strong class="ur_progress_number"><span id="percent"><%= format "%.2f" ,@percent %></span>%</strong> </div>
<div class="ur_progress_text">
<%= l(:label_complete_question) %>
<strong class="ur_progress_number">
<span id="percent"><%= format "%.2f" ,@percent %></span>%
</strong>
</div>
</div>
</div><!--问卷内容end-->
</body>
</html>

View File

@ -69,6 +69,8 @@ function regex_bid_name()
return true;
}
}
//验证匿评数量
function regex_evaluation_num()
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
@ -105,6 +107,7 @@ function regex_evaluation_num()
}
}
//点击是否开启匿评单选框效果
$(function(){
$("#bid_open_anonymous_evaluation").click(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
@ -118,10 +121,17 @@ $(function(){
});
});
//老师提交新建作业
function submit_new_bid(id)
{
if(regex_bid_name()&&regex_evaluation_num())
{
$("#"+id).submit();
}
}
//隐藏提示狂
function hidden_atert_form(cur_page,cur_type)
{
hideModal($("#popbox"));
}

View File

@ -142,5 +142,9 @@ a:hover.btn_pu{ background:#3cb761;}
.ur_button_submit{ float:left;}
.polls_cha{float:left; margin-left:15px; margin-top:10px;}
/*问卷提交时弹出框*/
.alert_box{width:480px;height:180px;position:fixed;z-index:100;left:55%;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;}
.commit{height: 28px;display: block;width: 80px;color: #fff !important;background: #15bccf;text-align: center;padding-top: 4px;margin-left: 130px;margin-top: 4px;margin-right: 10px;}