adds officing's polls index
This commit is contained in:
8
app/controllers/officing/polls_controller.rb
Normal file
8
app/controllers/officing/polls_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Officing::PollsController < Officing::BaseController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@polls = current_user.poll_officer? ? current_user.poll_officer.assigned_polls : []
|
||||||
|
@polls = @polls.select {|poll| poll.current?(1.day.ago)}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -13,5 +13,6 @@ class Poll
|
|||||||
map(&:poll).uniq.compact.
|
map(&:poll).uniq.compact.
|
||||||
sort {|x, y| y.ends_at <=> x.ends_at}
|
sort {|x, y| y.ends_at <=> x.ends_at}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li <%= "class=active" if controller_name == "results" %>>
|
<li <%= "class=active" if ["polls", "recounts"].include?(controller_name) %>>
|
||||||
<%= link_to new_officing_poll_result_path(Poll.last) do %>
|
<%= link_to officing_polls_path do %>
|
||||||
<span class="icon-user"></span>
|
<span class="icon-user"></span>
|
||||||
<%= t("officing.menu.results") %>
|
<%= t("officing.menu.recounts") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
30
app/views/officing/polls/index.html.erb
Normal file
30
app/views/officing/polls/index.html.erb
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<h2><%= t("officing.polls.index.title") %></h2>
|
||||||
|
|
||||||
|
<% if @polls.any? %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th><%= t("officing.polls.index.select_poll") %></th>
|
||||||
|
<th> </th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @polls.each do |poll| %>
|
||||||
|
<tr id="<%= dom_id(poll) %>" class="poll">
|
||||||
|
<td>
|
||||||
|
<strong>
|
||||||
|
<%= link_to poll.name, new_officing_poll_recount_path(poll) %>
|
||||||
|
</strong>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<%= link_to t("officing.polls.index.add_recount"),
|
||||||
|
new_officing_poll_recount_path(poll),
|
||||||
|
class: "button hollow" %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<div class="callout primary">
|
||||||
|
<%= t("officing.polls.index.no_polls") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -7,7 +7,13 @@ en:
|
|||||||
info: Here you can validate user documents and store voting results
|
info: Here you can validate user documents and store voting results
|
||||||
menu:
|
menu:
|
||||||
voters: Validate document
|
voters: Validate document
|
||||||
results: Store results
|
recounts: Store recount
|
||||||
|
polls:
|
||||||
|
index:
|
||||||
|
title: Poll list
|
||||||
|
no_polls: You are not officing in any active poll
|
||||||
|
select_poll: Select poll
|
||||||
|
add_recount: Add recount
|
||||||
voters:
|
voters:
|
||||||
new:
|
new:
|
||||||
title: Validate document
|
title: Validate document
|
||||||
|
|||||||
@@ -6,8 +6,14 @@ es:
|
|||||||
title: Presidir mesa de votaciones
|
title: Presidir mesa de votaciones
|
||||||
info: Aquí puedes validar documentos de ciudadanos y guardar los resultados de las urnas
|
info: Aquí puedes validar documentos de ciudadanos y guardar los resultados de las urnas
|
||||||
menu:
|
menu:
|
||||||
voters: Validar documento
|
voters: "Validar documento"
|
||||||
results: Guardar resultados
|
recounts: "Guardar recuento"
|
||||||
|
polls:
|
||||||
|
index:
|
||||||
|
title: "Listado de votaciones"
|
||||||
|
no_polls: "No eres presidente de mesa en ninguna votación activa"
|
||||||
|
select_poll: "Selecciona votación"
|
||||||
|
add_recount: "Añadir recuento"
|
||||||
voters:
|
voters:
|
||||||
new:
|
new:
|
||||||
title: Validar documento
|
title: Validar documento
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
namespace :officing do
|
namespace :officing do
|
||||||
resources :polls do
|
resources :polls, only: [:index] do
|
||||||
resources :voters, only: [:new, :show]
|
resources :voters, only: [:new, :show]
|
||||||
resources :results, only: [:new, :index, :show]
|
resources :results, only: [:new, :index, :show]
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user