1.增加问卷统计、问卷答卷等页面跳转,并增加对应路由

2.调整页面样式
3.动态分页
This commit is contained in:
sw 2015-01-13 15:59:02 +08:00
parent d8e6b4a92f
commit fc72d6f9a9
6 changed files with 356 additions and 21 deletions

View File

@ -1,5 +1,5 @@
class PollController < ApplicationController class PollController < ApplicationController
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy] before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result]
before_filter :find_container, :only => [:new,:create, :index] before_filter :find_container, :only => [:new,:create, :index]
before_filter :is_member_of_course, :only => [:index,:show] before_filter :is_member_of_course, :only => [:index,:show]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy]
@ -19,6 +19,11 @@ class PollController < ApplicationController
def show def show
@poll = Poll.find params[:id] @poll = Poll.find params[:id]
@poll_questions = @poll.poll_questions
respond_to do |format|
format.html {render :layout => 'base_courses'}
end
end end
def new def new
@ -70,6 +75,12 @@ class PollController < ApplicationController
end end
end end
def statistics_result
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
end
private private
def find_poll_and_course def find_poll_and_course
@poll = Poll.find params[:id] @poll = Poll.find params[:id]

View File

@ -1,12 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%= stylesheet_link_tag 'polls', :media => 'all' %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>问卷调查_列表</title>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
</head>
<body>
<div class="polls_content" id="polls"> <div class="polls_content" id="polls">
<div class="polls_head"> <div class="polls_head">
<h2>所有问卷 <h2>所有问卷
@ -21,15 +13,11 @@
<% @polls.each do |poll|%> <% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>"> <ul id="polls_<%= poll.id %>">
<li> <li>
<a href="#" class="polls_title fl"> <%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
<%= poll.polls_name%>
</a>
</li> </li>
<li> <li>
<%if @is_teacher%> <%if @is_teacher%>
<a href="#" class="pollsbtn fl ml10"> <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
<%= l(:label_statistical_results)%>
</a>
<% end%> <% end%>
</li> </li>
<li> <li>
@ -52,5 +40,3 @@
</div><!--列表end--> </div><!--列表end-->
</div><!--问卷内容end--> </div><!--问卷内容end-->
</body>
</html>

View File

@ -0,0 +1,114 @@
<!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>问卷调查_问卷页面</title>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
</head>
<body>
<div class="polls_content polls_box" id="polls">
<div class="ur_page_head" >
<h1 class="ur_page_title">
<%= @poll.polls_name%>
</h1>
<p class="ur_prefix_content">
<%= @poll.polls_description %>
</p>
</div>
<div class="ur_card">
<ol class="ur_questions">
<li class="ur_question_item radio">
<div class="ur_title">
<span class="title_index">第1题</span> 单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题 <span class="ur_required" title="必答">*</span>
</div>
<div class="ur_inputs">
<table class="ur_table" >
<tbody>
<tr>
<td>
<label ><input class="ur_radio" type="radio" value="新建选项" > 新建选项</label>
</td>
</tr>
<tr >
<td>
<label ><input class="ur_radio" type="radio" value="新建选项" > 新建选项</label>
</td>
</tr>
<tr>
<td>
<label ><input class="ur_radio" type="radio" value="新建选项" > 新建选项</label>
</td>
</tr>
</tbody>
</table>
</div>
</li><!--单选题 end-->
<li class="ur_question_item checkbox">
<div class="ur_title">
<span class="title_index">第2题</span> 多选题 <span class="ur_required" title="必答">*</span>
</div>
<div class="ur_inputs">
<table class="ur_table">
<tbody>
<tr>
<td>
<label ><input class="ur_checkbox" type="checkbox" value="新建选项" > 新建选项 </label>
</td>
</tr>
<tr class="ur_tr_even">
<td>
<label ><input class="ur_checkbox" type="checkbox" value="新建选项" > 新建选项 </label>
</td>
</tr>
<tr>
<td>
<label ><input class="ur_checkbox" type="checkbox" value="新建选项" > 新建选项 </label>
</td>
</tr>
</tbody>
</table>
</div>
</li><!--多选题 end-->
<li class="ur_question_item text">
<div class="ur_title">
<span class="title_index">第3题</span> 单行主观
</div>
<div class="ur_inputs">
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
</div>
</li><!--当行输入 end-->
<li class="ur_question_item textarea">
<div class="ur_preview">
<div class="ur_title">
<span class="title_index">第4题</span> 多行主观
</div>
<div class="ur_inputs">
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
</div>
</div>
</li><!--多行输入 end-->
</ol>
<div class="ur_buttons">
<a href="#" class=" ur_button" >下一页</a>
<a href="#" class="ur_button" >提交</a>
</div>
<div class="cl"></div>
<div class="ur_progress_text">答题已完成 <strong class="ur_progress_number">0%</strong> </div>
</div>
</div><!--问卷内容end-->
</body>
</html>

View File

@ -0,0 +1,220 @@
<!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>问卷调查_问卷结果</title>
<%= stylesheet_link_tag 'polls', :media => 'all' %>
</head>
<body>
<div class="polls_content polls_box">
<div class="ur_page_head" >
<h1 class="ur_page_title">某问卷统计</h1>
</div>
<div class="">
<ol>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第1题</span>问题描述问题描述 <span class="title_index">[单选题]</span>
</div>
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
<tr class="table_bluebg">
<td class="td327">选项 </td>
<td class="td42">小计 </td>
<td class="td287">比例 </td>
</tr>
<tr>
<td class="td327">第一选项 </td>
<td class="td42">24 </td>
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
</tr>
<tr>
<td class="td327">第二选项 </td>
<td class="td42">1 </td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr>
<td class="td327">第三选项 </td>
<td class="td42">1</td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr class="table_bluebg">
<td class="td327">本题有效填写人次 </td>
<td class="td42">26</td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>
</table>
</div>
</li>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第1题</span>问题描述问题描述 <span class="title_index">[单选题]</span>
</div>
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
<tr class="table_bluebg">
<td class="td327">选项 </td>
<td class="td42">小计 </td>
<td class="td287">比例 </td>
</tr>
<tr>
<td class="td327">第一选项 </td>
<td class="td42">24 </td>
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
</tr>
<tr>
<td class="td327">第二选项 </td>
<td class="td42">1 </td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr>
<td class="td327">第三选项 </td>
<td class="td42">1</td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr class="table_bluebg">
<td class="td327">本题有效填写人次 </td>
<td class="td42">26</td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>
</table>
</div>
</li>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第1题</span>问题描述问题描述 <span class="title_index">[单选题]</span>
</div>
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
<tr class="table_bluebg">
<td class="td327">选项 </td>
<td class="td42">小计 </td>
<td class="td287">比例 </td>
</tr>
<tr>
<td class="td327">第一选项 </td>
<td class="td42">24 </td>
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
</tr>
<tr>
<td class="td327">第二选项 </td>
<td class="td42">1 </td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr>
<td class="td327">第三选项 </td>
<td class="td42">1</td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr class="table_bluebg">
<td class="td327">本题有效填写人次 </td>
<td class="td42">26</td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>
</table>
</div>
</li>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第1题</span>问题描述问题描述 <span class="title_index">[单选题]</span>
</div>
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
<tr class="table_bluebg">
<td class="td327">选项 </td>
<td class="td42">小计 </td>
<td class="td287">比例 </td>
</tr>
<tr>
<td class="td327">第一选项 </td>
<td class="td42">24 </td>
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
</tr>
<tr>
<td class="td327">第二选项 </td>
<td class="td42">1 </td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr>
<td class="td327">第三选项 </td>
<td class="td42">1</td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr class="table_bluebg">
<td class="td327">本题有效填写人次 </td>
<td class="td42">26</td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>
</table>
</div>
</li>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第1题</span>问题描述问题描述 <span class="title_index">[单选题]</span>
</div>
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
<tr class="table_bluebg">
<td class="td327">选项 </td>
<td class="td42">小计 </td>
<td class="td287">比例 </td>
</tr>
<tr>
<td class="td327">第一选项 </td>
<td class="td42">24 </td>
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
</tr>
<tr>
<td class="td327">第二选项 </td>
<td class="td42">1 </td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr>
<td class="td327">第三选项 </td>
<td class="td42">1</td>
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
</tr>
<tr class="table_bluebg">
<td class="td327">本题有效填写人次 </td>
<td class="td42">26</td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>
</table>
</div>
</li>
</ol>
<div class="ur_buttons">
<!--<a href="#" class=" ur_button" >上一页</a>-->
<!--<a href="#" class="ur_button" >下一页</a>-->
</div>
<div class="cl"></div>
<div class="ur_progress_text">答题已完成 <strong class="ur_progress_number">0%</strong> </div>
</div>
</div><!--问卷内容end-->
</body>
</html>

View File

@ -58,7 +58,11 @@ RedmineApp::Application.routes.draw do
end end
end end
resources :poll resources :poll do
member do
get 'statistics_result'
end
end
resources :contest_notification resources :contest_notification

View File

@ -46,7 +46,7 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
.ur_inputs label{ padding-left:10px;} .ur_inputs label{ padding-left:10px;}
.ur_inputs input{ margin-right:5px;} .ur_inputs input{ margin-right:5px;}
.ur_text{ height:30px;} .ur_text{ height:30px;}
.ur_textbox{ border:1px solid #dcdcdc; color:#676765;} .ur_textbox{ border:1px solid #dcdcdc !important; color:#676765;}
.ur_buttons{ width:250px; margin:20px auto 10px;} .ur_buttons{ width:250px; margin:20px auto 10px;}
a.ur_button{ display:block; width:106px; height:37px; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:3px; float:left; margin-right:15px;} a.ur_button{ display:block; width:106px; height:37px; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:3px; float:left; margin-right:15px;}
a:hover.ur_button{ background:#0fa9bb; text-decoration:none;} a:hover.ur_button{ background:#0fa9bb; text-decoration:none;}