diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb
index 7998f29a2..221a623ef 100644
--- a/app/controllers/admin/poll/booth_assignments_controller.rb
+++ b/app/controllers/admin/poll/booth_assignments_controller.rb
@@ -45,6 +45,10 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
redirect_to admin_poll_booth_assignments_path(@booth_assignment.poll_id), notice: notice
end
+ def manage
+ @booths = ::Poll::Booth.all
+ end
+
private
def load_booth_assignment
diff --git a/app/controllers/admin/poll/polls_controller.rb b/app/controllers/admin/poll/polls_controller.rb
index 5103275fb..8ba6e934e 100644
--- a/app/controllers/admin/poll/polls_controller.rb
+++ b/app/controllers/admin/poll/polls_controller.rb
@@ -47,6 +47,10 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
redirect_to admin_poll_path(@poll), notice: notice
end
+ def booth_assignments
+ @polls = Poll.current_or_incoming
+ end
+
private
def load_geozones
diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb
index 1bc8d5e0c..704f9be24 100644
--- a/app/models/abilities/administrator.rb
+++ b/app/models/abilities/administrator.rb
@@ -56,10 +56,10 @@ module Abilities
can [:index, :create, :edit, :update, :destroy], Geozone
- can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers], Poll
+ can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers, :booth_assignments], Poll
can [:read, :create, :update, :destroy, :available], Poll::Booth
can [:search, :create, :index, :destroy], ::Poll::Officer
- can [:create, :destroy], ::Poll::BoothAssignment
+ can [:create, :destroy, :manage], ::Poll::BoothAssignment
can [:create, :destroy], ::Poll::OfficerAssignment
can [:read, :create, :update], Poll::Question
can :destroy, Poll::Question # , comments_count: 0, votes_up: 0
diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb
index f2af2c116..0518aa0e3 100644
--- a/app/views/admin/_menu.html.erb
+++ b/app/views/admin/_menu.html.erb
@@ -60,7 +60,8 @@
<%= t("admin.menu.title_polls") %>
<% end %>
diff --git a/app/views/admin/poll/booth_assignments/manage.html.erb b/app/views/admin/poll/booth_assignments/manage.html.erb
new file mode 100644
index 000000000..65cec228a
--- /dev/null
+++ b/app/views/admin/poll/booth_assignments/manage.html.erb
@@ -0,0 +1,25 @@
+<%= t("admin.booths.index.title") %>
+
+<% if controller_name == "booths" && action_name != "available" %>
+ <%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button success float-right" %>
+<% end %>
+
+<% if @booths.empty? %>
+
+ <%= t("admin.booths.index.no_booths") %>
+
+<% end %>
+
+<% if @booths.any? %>
+
+
+ | <%= t("admin.booths.index.name") %> |
+ <%= t("admin.actions.actions") %> |
+
+
+ <% @booths.each do |booth| %>
+ <% end %>
+
+
+
+<% end %>
diff --git a/app/views/admin/poll/polls/booth_assignments.html.erb b/app/views/admin/poll/polls/booth_assignments.html.erb
new file mode 100644
index 000000000..0d9bf98ce
--- /dev/null
+++ b/app/views/admin/poll/polls/booth_assignments.html.erb
@@ -0,0 +1,18 @@
+<%= t("admin.polls.index.title") %>
+
+<% if @polls.any? %>
+
+
+ | <%= t("admin.polls.index.name") %> |
+ <%= t("admin.polls.index.dates") %> |
+ <%= t("admin.actions.actions") %> |
+
+
+ <%= render @polls %>
+
+
+<% else %>
+
+ <%= t("admin.polls.index.no_polls") %>
+
+<% end %>
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index 38abe6f56..a2657a2b3 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -409,6 +409,7 @@ en:
poll_officers: Poll officers
polls: Polls
poll_booths: Booths location
+ poll_booth_assignments: Booths Assignments
poll_shifts: Manage shifts
officials: Officials
organizations: Organisations
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 3336cdc5b..4c56e131c 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -420,6 +420,7 @@ es:
poll_officers: Presidentes de mesa
polls: Votaciones
poll_booths: Ubicación de urnas
+ poll_booth_assignments: Asignación de urnas
poll_shifts: Asignar turnos
officials: Cargos públicos
organizations: Organizaciones
diff --git a/config/routes.rb b/config/routes.rb
index ae4f7280c..6f94594a3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -111,7 +111,7 @@ Rails.application.routes.draw do
resources :annotations do
get :search, on: :collection
end
-
+
resources :polls, only: [:show, :index] do
resources :questions, controller: 'polls/questions', shallow: true do
post :answer, on: :member
@@ -273,10 +273,12 @@ Rails.application.routes.draw do
scope module: :poll do
resources :polls do
+ get :booth_assignments, on: :collection
patch :add_question, on: :member
resources :booth_assignments, only: [:index, :show, :create, :destroy] do
get :search_booths, on: :collection
+ get :manage, on: :collection
end
resources :officer_assignments, only: [:index, :create, :destroy] do