Merge pull request #1411 from consul/polls-admin

Polls admin
This commit is contained in:
Juanjo Bazán
2017-02-09 20:21:16 +01:00
committed by GitHub
12 changed files with 97 additions and 51 deletions

View File

@@ -77,6 +77,7 @@ body.admin {
}
&.text-right {
padding-right: $line-height;
text-align: right;
}
@@ -94,9 +95,20 @@ body.admin {
}
}
&.fixed {
table-layout: fixed;
}
input[type="submit"] ~ a, a ~ a {
margin-left: $line-height/2;
margin-right: $line-height/2;
margin-left: 0;
margin-right: 0;
margin-top: $line-height/2;
@include breakpoint(medium) {
margin-left: $line-height/2;
margin-right: $line-height/2;
margin-top: 0;
}
}
}

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

@@ -7,7 +7,7 @@
<td>
<%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %>
</td>
<td class="text-right">
<td>
<%= link_to t("admin.actions.edit"),
edit_admin_poll_path(poll),
class: "button hollow" %>

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>

View File

@@ -5,11 +5,11 @@
class: "button success float-right" %>
<% if @polls.any? %>
<table>
<table class="fixed">
<thead>
<th><%= t("admin.polls.index.name") %></th>
<th><%= t("admin.polls.index.dates") %></th>
<th>&nbsp;</th>
<th><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<%= render @polls %>

View File

@@ -7,16 +7,24 @@
<%= t('admin.questions.index.no_questions') %>
</div>
<% else %>
<table>
<% @questions.each do |question| %>
<tr id="<%= dom_id(question) %>">
<td><%= link_to question.title, admin_question_path(question) %></td>
<td class="text-right">
<%= link_to t('shared.edit'), edit_admin_question_path(question), class: "button hollow" %>
<%= link_to t('shared.delete'), admin_question_path(question), class: "button hollow alert", method: :delete %>
</td>
</tr>
<% end %>
<table class="fixed">
<thead>
<tr>
<th><%= t('admin.questions.index.table_question') %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</tr>
</thead>
<tbody>
<% @questions.each do |question| %>
<tr id="<%= dom_id(question) %>">
<td><%= link_to question.title, admin_question_path(question) %></td>
<td class="text-right">
<%= link_to t('shared.edit'), edit_admin_question_path(question), class: "button hollow" %>
<%= link_to t('shared.delete'), admin_question_path(question), class: "button hollow alert", method: :delete %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @questions %>

View File

@@ -1,4 +1,10 @@
<table>
<table class="fixed">
<thead>
<tr>
<th><%= t('admin.questions.index.table_proposal') %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</tr>
</thead>
<tbody>
<% @proposals.each do |proposal| %>
<tr id="<%= dom_id(proposal) %>">

View File

@@ -2,6 +2,7 @@
en:
admin:
actions:
actions: Actions
confirm: Are you sure?
confirm_hide: Confirm
hide: Hide
@@ -359,6 +360,8 @@ en:
questions_tab: "Questions"
successful_proposals_tab: "Successful proposals"
create_question: "Create question"
table_proposal: "Proposal"
table_question: "Question"
edit:
title: "Edit Question"
new:

View File

@@ -2,6 +2,7 @@
es:
admin:
actions:
actions: Acciones
confirm: "¿Estás seguro?"
confirm_hide: Confirmar
hide: Ocultar
@@ -359,6 +360,8 @@ es:
questions_tab: "Preguntas ciudadanas"
successful_proposals_tab: "Propuestas que han superado el umbral"
create_question: "Crear pregunta para votación"
table_proposal: "Propuesta"
table_question: "Pregunta"
edit:
title: "Editar pregunta ciudadana"
new: