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

View File

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

View File

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

View File

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

View File

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