socialforge/app/views/poll/_choice_show.html.erb

64 lines
2.4 KiB
Plaintext

<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" >
<tbody>
<tr class="table_bluebg">
<td class="td327"><%= l(:label_poll_options) %> </td>
<td class="td42"><%= l(:label_poll_subtotal) %> </td>
<td class="td287"><%= l(:label_poll_proportion) %> </td>
</tr>
<% poll_question.poll_answers.each do |poll_answer| %>
<tr>
<td class="td327">
<% if poll_answer.answer_text == "" %>
其它<a onclick="hidden_others(<%= poll_question.id %>, <%= poll_answer.id %>);" class="c_blue fr mr5" id ="other_answer_<%= poll_answer.id %>"><%= "隐藏" if other_answers(poll_question).count > 0 %></a>
<% else %>
<%= poll_answer.answer_text %>
<% end %>
</td>
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
<td class="td287">
<div class="Bar">
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
</div>
<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%</td>
</tr>
<% end %>
</tbody>
</table>
<div id="other_tip_<%= poll_question.id %>" style="display: block">
<% if other_answers(poll_question).count > 0 %>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class="table_bluebg"><td class="pl5 w607">其它(详情)</td></tr>
<% other_answers(poll_question).each do |pv| %>
<tr><td class="pl5 w607"><%= pv.vote_text %></td></tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<tr class="table_bluebg">
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
<td class="td42"><%= total_answer(poll_question.id) %></td>
<td class="td287">&nbsp; </td>
</tr>
</table>
</div>
<script>
function hidden_others(id1, id2){
var other_answer = document.getElementById("other_answer_"+id2).innerText;
if (other_answer == "隐藏")
{
$("#other_answer_"+id2).text("显示");
$("#other_tip_"+id1).hide();
}
else
{
$("#other_answer_"+id2).text("隐藏");
$("#other_tip_"+id1).show();
}
}
</script>