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

View File

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

View File

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