Files
nairobi/app/components/admin/poll/results/question_component.html.erb
taitus e3e475b4df Add votes_for(option) method and simplify results template
Move the summing logic from the template into the component. Introduce
a votes_for(option) method that looks up grouped partial results and
returns the total amount or 0.
2025-09-26 09:59:10 +02:00

20 lines
600 B
Plaintext

<div class="admin-poll-results-question">
<h3><%= question.title %></h3>
<table class="margin">
<thead>
<tr>
<th><%= t("admin.results.result.table_answer") %></th>
<th class="text-center"><%= t("admin.results.result.table_votes") %></th>
</tr>
</thead>
<tbody>
<% question.question_options.each_with_index do |option, i| %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= option.title %></td>
<td class="text-center"><%= votes_for(option) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>