improves styles for officing results table

This commit is contained in:
Alberto Garcia Cabeza
2017-02-02 17:08:00 +01:00
parent 3dd33c4247
commit 095545cd48
3 changed files with 32 additions and 16 deletions

View File

@@ -3,26 +3,38 @@
<% if @partial_results.present? %>
<div class="callout primary">
<h3><%= @booth_assignment.booth.name %> - <%= l @partial_results.first.date, format: :long %></h3>
<h3>
<%= @booth_assignment.booth.name %> - <%= l @partial_results.first.date, format: :long %>
</h3>
</div>
<% by_question = @partial_results.group_by(&:question_id) %>
<% @poll.questions.each do |question| %>
<h3><%= question.title %></h3>
<div class="row">
<div class="small-12 medium-9 column">
<% by_question = @partial_results.group_by(&:question_id) %>
<% @poll.questions.each do |question| %>
<h3><%= question.title %></h3>
<table>
<tbody>
<% question.valid_answers.each_with_index do |answer, i| %>
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= answer %></td>
<td><%= by_answer[answer].present? ? by_answer[answer].first.amount : 0 %></td>
</tr>
<% end %>
</tbody>
</table>
<table>
<thead>
<tr>
<th><%= t("officing.results.index.table_answer") %></th>
<th><%= t("officing.results.index.table_votes") %></th>
</tr>
</thead>
<tbody>
<% question.valid_answers.each_with_index do |answer, i| %>
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= answer %></td>
<td><%= by_answer[answer].present? ? by_answer[answer].first.amount : 0 %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
</div>
</div>
<% else %>
<div class="callout primary">
<%= t("officing.results.index.no_results") %>

View File

@@ -74,6 +74,8 @@ en:
index:
no_results: "No results"
results: Results
table_answer: Answer
table_votes: Votes
residence:
flash:
create: "Document verified with Census"

View File

@@ -74,6 +74,8 @@ es:
index:
no_results: "No hay resultados"
results: "Resultados"
table_answer: Respuesta
table_votes: Votos
residence:
flash:
create: "Documento verificado con el Padrón"