This commit is contained in:
sw 2015-01-16 17:34:52 +08:00
commit f99d159ca1
5 changed files with 52 additions and 49 deletions

View File

@ -50,7 +50,9 @@ module PollHelper
#统计答题百分比
def statistics_result_percentage(e, t)
return e*100/t
e = e.to_f
t = t.to_f
t == 0 ? 0 : format("%.2f", e*100/t)
end
def options_show p

View File

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>问卷调查_问卷页面</title>
<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;}
@ -46,10 +46,10 @@
<!-- 单选题 -->
<li class="ur_question_item radio">
<div class="ur_title">
<span class="title_index"><%= pq.question_number %>题:</span>
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="必答">*</span>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
@ -95,10 +95,10 @@
<!-- 多选题 -->
<li class="ur_question_item checkbox">
<div class="ur_title">
<span class="title_index"><%= pq.question_number %>题:</span>
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="必答">*</span>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
@ -151,10 +151,10 @@
<!-- 单行文字-->
<li class="ur_question_item text">
<div class="ur_title">
<span class="title_index"><%= pq.question_number %>题:</span>
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="必答">*</span>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
@ -188,10 +188,10 @@
<li class="ur_question_item textarea">
<div class="ur_preview">
<div class="ur_title">
<span class="title_index"><%= pq.question_number %>题:</span>
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="必答">*</span>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
@ -237,11 +237,11 @@
<div class="cl"></div>
<div class="ur_buttons" style="width: 100px;">
<% if @poll.polls_status == 2 %>
<%= link_to "提交",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">答题已完成 <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>

View File

@ -1,38 +1,33 @@
<!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_result) %></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 %> <%= l(:label_poll) %></h1>
</div>
<% @poll_questions.each do |poll_question| %>
<div class="">
<ol>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第<%= poll_question.question_number %>题:</span><%= poll_question.question_title %>
<span class="title_index">[<%= options_show(poll_question.question_type) %>]</span>
</div>
<%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
</li>
</ol>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<div class="ur_buttons">
</div>
<div class="cl"></div>
</div>
</div><!--问卷内容end-->
</body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%= l(:label_poll_result) %></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 %> <%= l(:label_poll) %></h1>
</div>
<% @poll_questions.each do |poll_question| %>
<div class="">
<ol>
<li class="ur_question_item">
<div class="ur_title_result">
<span class="title_index">第<%= poll_question.question_number %>题:</span><%= poll_question.question_title %> <span class="title_index">[<%= options_show(poll_question.question_type) %>]</span>
</div>
<%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
</li>
</ol>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<div class="ur_buttons"></div>
<div class="cl"></div>
</div>
</div>
</body>
</html>

View File

@ -1817,8 +1817,10 @@ en:
label_record: 湘ICP备09019772
label_check_comment: Check comment
label_notification: Notification
label_must_answer: Will answer
label_poll_title: The questionnaire survey _ questionnaire page
label_question_number: 'question %{question_number}:'
label_complete_question: The answer has been completed
#end
# ajax异步验证

View File

@ -964,6 +964,8 @@ zh:
label_default: 默认
label_search_titles_only: 仅在标题中搜索
label_user_mail_option_all: "收取我的项目的所有通知"
label_must_answer: "必答"
label_poll_title: 问卷调查_问卷页面
#huang
label_file_new: 下载
label_user_edit: "修改资料"
@ -1419,6 +1421,8 @@ zh:
other: 参与了 %{count} 个项目:
#end
label_total_commit: 共%{total_commit}次提交
label_question_number: 第%{question_number}题:
label_complete_question: 答题已完成
#modify by men
label_x_total_commit:
zero: 共 %{count} 次提交