diff --git a/app/controllers/officing/polls_controller.rb b/app/controllers/officing/polls_controller.rb new file mode 100644 index 000000000..0634bccb5 --- /dev/null +++ b/app/controllers/officing/polls_controller.rb @@ -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 \ No newline at end of file diff --git a/app/models/poll/officer.rb b/app/models/poll/officer.rb index 14eec442f..138a582fc 100644 --- a/app/models/poll/officer.rb +++ b/app/models/poll/officer.rb @@ -13,5 +13,6 @@ class Poll map(&:poll).uniq.compact. sort {|x, y| y.ends_at <=> x.ends_at} end + end end \ No newline at end of file diff --git a/app/views/officing/_menu.html.erb b/app/views/officing/_menu.html.erb index 889e9b310..d999fc06b 100644 --- a/app/views/officing/_menu.html.erb +++ b/app/views/officing/_menu.html.erb @@ -8,10 +8,10 @@ <% end %> -
  • > - <%= link_to new_officing_poll_result_path(Poll.last) do %> +
  • > + <%= link_to officing_polls_path do %> - <%= t("officing.menu.results") %> + <%= t("officing.menu.recounts") %> <% end %>
  • diff --git a/app/views/officing/polls/index.html.erb b/app/views/officing/polls/index.html.erb new file mode 100644 index 000000000..8f3e4921e --- /dev/null +++ b/app/views/officing/polls/index.html.erb @@ -0,0 +1,30 @@ +

    <%= t("officing.polls.index.title") %>

    + +<% if @polls.any? %> + + + + + + + <% @polls.each do |poll| %> + + + + + <% end %> + +
    <%= t("officing.polls.index.select_poll") %> 
    + + <%= link_to poll.name, new_officing_poll_recount_path(poll) %> + + + <%= link_to t("officing.polls.index.add_recount"), + new_officing_poll_recount_path(poll), + class: "button hollow" %> +
    +<% else %> +
    + <%= t("officing.polls.index.no_polls") %> +
    +<% end %> \ No newline at end of file diff --git a/config/locales/officing.en.yml b/config/locales/officing.en.yml index a477c793e..87d4e77c4 100644 --- a/config/locales/officing.en.yml +++ b/config/locales/officing.en.yml @@ -7,7 +7,13 @@ en: info: Here you can validate user documents and store voting results menu: 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: new: title: Validate document diff --git a/config/locales/officing.es.yml b/config/locales/officing.es.yml index 6a49184c6..0831ba821 100644 --- a/config/locales/officing.es.yml +++ b/config/locales/officing.es.yml @@ -6,8 +6,14 @@ es: title: Presidir mesa de votaciones info: Aquí puedes validar documentos de ciudadanos y guardar los resultados de las urnas menu: - voters: Validar documento - results: Guardar resultados + voters: "Validar documento" + 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: new: title: Validar documento diff --git a/config/routes.rb b/config/routes.rb index bc6e719d0..98011d005 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -289,7 +289,7 @@ Rails.application.routes.draw do end namespace :officing do - resources :polls do + resources :polls, only: [:index] do resources :voters, only: [:new, :show] resources :results, only: [:new, :index, :show] end