Unify Officing and Admin results views

Unify the code from app/views/officing/results/index.html.erb with
app/views/admin/poll/results/_result.html.erb. This prepares the ground
to extract a component in the next commit and avoid duplication.
This commit is contained in:
taitus
2025-09-17 15:40:58 +02:00
parent 896ebc82fd
commit bc6506da5a
3 changed files with 4 additions and 8 deletions

View File

@@ -31,11 +31,11 @@
<% @poll.questions.each do |question| %> <% @poll.questions.each do |question| %>
<h3><%= question.title %></h3> <h3><%= question.title %></h3>
<table> <table class="margin">
<thead> <thead>
<tr> <tr>
<th><%= t("officing.results.index.table_answer") %></th> <th><%= t("admin.results.result.table_answer") %></th>
<th><%= t("officing.results.index.table_votes") %></th> <th class="text-center"><%= t("admin.results.result.table_votes") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -43,7 +43,7 @@
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %> <% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result"> <tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= option.title %></td> <td><%= option.title %></td>
<td><%= by_answer[option.title].present? ? by_answer[option.title].first.amount : 0 %></td> <td class="text-center"><%= by_answer[option.title].present? ? by_answer[option.title].sum(&:amount) : 0 %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -57,8 +57,6 @@ en:
index: index:
no_results: "No results" no_results: "No results"
results: Results results: Results
table_answer: Answer
table_votes: Votes
table_whites: "Totally blank ballots" table_whites: "Totally blank ballots"
table_nulls: "Invalid ballots" table_nulls: "Invalid ballots"
table_total: "Valid ballots" table_total: "Valid ballots"

View File

@@ -57,8 +57,6 @@ es:
index: index:
no_results: "No hay resultados" no_results: "No hay resultados"
results: Resultados results: Resultados
table_answer: Respuesta
table_votes: Votos
table_whites: "Papeletas totalmente en blanco" table_whites: "Papeletas totalmente en blanco"
table_nulls: "Papeletas nulas" table_nulls: "Papeletas nulas"
table_total: "Papeletas válidas" table_total: "Papeletas válidas"