This commit is contained in:
sw 2015-01-17 11:09:39 +08:00
commit e8f3bd4dbb
4 changed files with 9 additions and 7 deletions

View File

@ -48,15 +48,16 @@ module PollHelper
end
end
#统计答题百分比
#统计答题百分比,统计结果保留两位小数
def statistics_result_percentage(e, t)
e = e.to_f
t = t.to_f
t == 0 ? 0 : format("%.2f", e*100/t)
end
def options_show p
case p
#页面体型显示
def options_show pq
case pq
when 1
"单选题"
when 2
@ -65,4 +66,5 @@ module PollHelper
"问答题"
end
end
end

View File

@ -19,7 +19,7 @@
<% end %>
<tr class="table_bluebg">
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
<td class="td42"><%= poll_question.poll_votes.count %></td>
<td class="td42"><%= @poll.users.count %></td>
<td class="td287">&nbsp; </td>
</tr>
</tbody>

View File

@ -180,7 +180,7 @@
}
</script>
<input class="ur_text ur_textbox" type="text" size="" maxlength="" value="<%= get_anwser_vote_text(pq.id,User.current.id) %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
<input class="ur_text ur_textbox" type="text" size="" maxlength="" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
</div>
</li><!--单行输入 end-->
<% elsif pq.question_type == 4 %>
@ -222,7 +222,7 @@
});
}
</script>
<div contenteditable='<%= @can_edit_poll %>' class="ur_textbox" style="min-height: 150px;width: 100%;<%= @can_edit_poll?"":"background-color:#DCDCDC;" %>" onblur="onblur_<%= pq.id %>(this);"><%= get_anwser_vote_text(pq.id,User.current.id) %></div>
<div contenteditable='<%= @can_edit_poll %>' class="ur_textbox" style="min-height: 150px;width: 100%;<%= @can_edit_poll?"":"background-color:#DCDCDC;" %>" onblur="onblur_<%= pq.id %>(this);"><%= get_anwser_vote_text(pq.id,User.current.id).html_safe %></div>
</div>
</div>
</li><!--多行输入 end-->

View File

@ -27,7 +27,7 @@
<div class="cl"></div>
<div class="ur_buttons"></div>
<div class="cl"></div>
</div>
</div>
</div>
</body>
</html>