improves tables layout on admin polls show views

This commit is contained in:
Alberto Garcia Cabeza
2017-02-09 19:03:06 +01:00
parent ff0013e60c
commit f7971a3c9f
5 changed files with 49 additions and 35 deletions

View File

@@ -40,12 +40,12 @@
</div>
<% else %>
<h3><%= t("admin.poll_officer_assignments.index.assignments") %></h3>
<table>
<table class="fixed">
<thead>
<tr>
<th><%= t("admin.poll_officer_assignments.index.date") %></th>
<th><%= t("admin.poll_officer_assignments.index.booth") %></th>
<th class="text-center"><%= t("admin.poll_officer_assignments.index.assignment") %></th>
<th class="text-right"><%= t("admin.poll_officer_assignments.index.assignment") %></th>
</tr>
</thead>
<tbody>
@@ -53,7 +53,7 @@
<tr id="<%= dom_id officer_assignment %>">
<td><%= officer_assignment.final? ? t('polls.final_date') : l(officer_assignment.date.to_date) %></td>
<td><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %></td>
<td class="text-center">
<td class="text-right">
<%= link_to t("admin.poll_officer_assignments.index.remove_assignment"),
admin_officer_assignment_path(officer_assignment),
method: :delete,
@@ -68,12 +68,12 @@
<% voting_days_officer_assignments = @officer_assignments.select{|oa| oa.final == false} %>
<% if voting_days_officer_assignments.any? %>
<h3><%= t("admin.poll_officer_assignments.index.recounts") %></h3>
<table id="recount_list">
<table id="recount_list" class="fixed">
<thead>
<tr>
<th><%= t("admin.poll_officer_assignments.index.date") %></th>
<th><%= t("admin.poll_officer_assignments.index.booth") %></th>
<th><%= t("admin.poll_officer_assignments.index.recount") %></th>
<th class="text-right"><%= t("admin.poll_officer_assignments.index.recount") %></th>
</tr>
</thead>
<tbody>
@@ -81,11 +81,13 @@
<tr id="recount_<%= officer_assignment.date.to_date.strftime('%Y%m%d') %>">
<td><%= l(officer_assignment.date.to_date) %></td>
<td><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %></td>
<% if officer_assignment.recount.present? %>
<td><%= officer_assignment.recount.count %></td>
<% else %>
<td> - </td>
<% end %>
<td class="text-right">
<% if officer_assignment.recount.present? %>
<%= officer_assignment.recount.count %>
<% else %>
<span>-</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
@@ -95,12 +97,12 @@
<% final_officer_assignments = @officer_assignments.select{|oa| oa.final == true} %>
<% if final_officer_assignments.any? %>
<h3><%= t("admin.poll_officer_assignments.index.final_recounts") %></h3>
<table id="final_recount_list">
<table id="final_recount_list" class="fixed">
<thead>
<tr>
<th><%= t("admin.poll_officer_assignments.index.date") %></th>
<th><%= t("admin.poll_officer_assignments.index.booth") %></th>
<th><%= t("admin.poll_officer_assignments.index.final_recount") %></th>
<th class="text-right"><%= t("admin.poll_officer_assignments.index.final_recount") %></th>
</tr>
</thead>
<tbody>
@@ -108,11 +110,13 @@
<tr id="final_recount_<%= officer_assignment.date.to_date.strftime('%Y%m%d') %>">
<td><%= l(officer_assignment.date.to_date) %></td>
<td><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %></td>
<% if officer_assignment.final_recounts.any? %>
<td><%= officer_assignment.final_recounts.to_a.sum(&:count) %></td>
<% else %>
<td> - </td>
<% end %>
<td class="text-right">
<% if officer_assignment.final_recounts.any? %>
<%= officer_assignment.final_recounts.to_a.sum(&:count) %>
<% else %>
<span>-</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>

View File

@@ -5,11 +5,11 @@
<%= t("admin.polls.show.no_booths") %>
</div>
<% else %>
<table id="assigned_booths_list" class="margin">
<table id="assigned_booths_list" class="fixed margin">
<thead>
<th><%= t("admin.polls.show.table_name") %></th>
<th><%= t("admin.polls.show.table_location") %></th>
<th class="text-center"><%= t("admin.polls.show.table_assignment") %></th>
<th class="text-right"><%= t("admin.polls.show.table_assignment") %></th>
</thead>
<tbody>
<% @poll.booth_assignments.each do |booth_assignment| %>
@@ -22,7 +22,7 @@
<td>
<%= booth_assignment.booth.location %>
</td>
<td class="text-center">
<td class="text-right">
<%= link_to t("admin.polls.show.remove_booth"),
admin_booth_assignment_path(booth_assignment),
method: :delete,

View File

@@ -5,10 +5,11 @@
<%= t("admin.polls.show.no_officers") %>
</div>
<% else %>
<table class="margin">
<table class="fixed margin">
<thead>
<th><%= t("admin.polls.show.table_name") %></th>
<th><%= t("admin.polls.show.table_email") %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<% @poll.officers.each do |officer| %>
@@ -21,6 +22,11 @@
<td>
<%= officer.email %>
</td>
<td class="text-right">
<%= link_to t("admin.polls.show.edit_officer_assignments"),
admin_officer_assignments_path(officer: officer, poll: @poll),
class: "button hollow" %>
</td>
</tr>
<% end %>
</tbody>

View File

@@ -5,11 +5,11 @@
<%= t('admin.polls.show.no_questions') %>
</div>
<% else %>
<table class="margin">
<table class="fixed margin">
<thead>
<tr>
<th><%= t('admin.polls.show.table_title') %></th>
<th class="text-center"><%= t('admin.polls.show.table_assignment') %></th>
<th class="text-right"><%= t('admin.polls.show.table_assignment') %></th>
</tr>
</thead>
<% @poll.questions.each do |question| %>
@@ -19,7 +19,7 @@
<%= link_to question.title, admin_question_path(question) %>
</strong>
</td>
<td class="text-center">
<td class="text-right">
<%= link_to t('admin.polls.show.remove_question'),
remove_question_admin_poll_path(poll_id: @poll.id, question_id: question.id),
class: "button hollow alert",

View File

@@ -5,7 +5,7 @@
<%= t("admin.polls.show.no_recounts") %>
</div>
<% else %>
<table class="margin">
<table class="fixed margin">
<thead>
<th><%= t("admin.polls.show.table_booth_name") %></th>
<th class="text-center"><%= t("admin.polls.show.table_recounts") %></th>
@@ -19,16 +19,20 @@
<%= link_to booth_assignment.booth.name, admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: 'tab-recounts') %>
</strong>
</td>
<% if booth_assignment.recounts.any? %>
<td class="text-center"><%= booth_assignment.recounts.to_a.sum(&:count) %></td>
<% else %>
<td class="text-center"> - </td>
<% end %>
<% if booth_assignment.final_recounts.any? %>
<td class="text-center"><strong><%= booth_assignment.final_recounts.to_a.sum(&:count) %></strong></td>
<% else %>
<td class="text-center"> - </td>
<% end %>
<td class="text-center">
<% if booth_assignment.recounts.any? %>
<%= booth_assignment.recounts.to_a.sum(&:count) %>
<% else %>
<span>-</span>
<% end %>
</td>
<td class="text-center">
<% if booth_assignment.final_recounts.any? %>
<strong><%= booth_assignment.final_recounts.to_a.sum(&:count) %></strong>
<% else %>
<span>-</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>