Add Poll booth_assignments and :Poll::BoothAssignment manage routes, actions and views
This commit is contained in:
@@ -45,6 +45,10 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
|||||||
redirect_to admin_poll_booth_assignments_path(@booth_assignment.poll_id), notice: notice
|
redirect_to admin_poll_booth_assignments_path(@booth_assignment.poll_id), notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def manage
|
||||||
|
@booths = ::Poll::Booth.all
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_booth_assignment
|
def load_booth_assignment
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
redirect_to admin_poll_path(@poll), notice: notice
|
redirect_to admin_poll_path(@poll), notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def booth_assignments
|
||||||
|
@polls = Poll.current_or_incoming
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_geozones
|
def load_geozones
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ module Abilities
|
|||||||
|
|
||||||
can [:index, :create, :edit, :update, :destroy], Geozone
|
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 [:read, :create, :update, :destroy, :available], Poll::Booth
|
||||||
can [:search, :create, :index, :destroy], ::Poll::Officer
|
can [:search, :create, :index, :destroy], ::Poll::Officer
|
||||||
can [:create, :destroy], ::Poll::BoothAssignment
|
can [:create, :destroy, :manage], ::Poll::BoothAssignment
|
||||||
can [:create, :destroy], ::Poll::OfficerAssignment
|
can [:create, :destroy], ::Poll::OfficerAssignment
|
||||||
can [:read, :create, :update], Poll::Question
|
can [:read, :create, :update], Poll::Question
|
||||||
can :destroy, Poll::Question # , comments_count: 0, votes_up: 0
|
can :destroy, Poll::Question # , comments_count: 0, votes_up: 0
|
||||||
|
|||||||
@@ -60,7 +60,8 @@
|
|||||||
<strong><%= t("admin.menu.title_polls") %></strong>
|
<strong><%= t("admin.menu.title_polls") %></strong>
|
||||||
</a>
|
</a>
|
||||||
<ul id="polls_menu" <%= "class=is-active" if menu_polls? || controller.class.parent == Admin::Poll::Questions::Answers %>>
|
<ul id="polls_menu" <%= "class=is-active" if menu_polls? || controller.class.parent == Admin::Poll::Questions::Answers %>>
|
||||||
<li <%= "class=active" if ["polls", "officer_assignments", "booth_assignments", "recounts", "results"].include? controller_name %>>
|
<li <%= "class=active" if ["polls", "officer_assignments", "booth_assignments", "recounts", "results"].include? controller_name &&
|
||||||
|
action_name != "booth_assignments" %>>
|
||||||
<%= link_to t('admin.menu.polls'), admin_polls_path %>
|
<%= link_to t('admin.menu.polls'), admin_polls_path %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -84,6 +85,10 @@
|
|||||||
action_name == "available" %>>
|
action_name == "available" %>>
|
||||||
<%= link_to t('admin.menu.poll_shifts'), available_admin_booths_path %>
|
<%= link_to t('admin.menu.poll_shifts'), available_admin_booths_path %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li <%= "class=active" if (controller_name == "polls" && action_name == "booth_assignments") || (controller_name == "booth_assignments" && action_name == "manage") %>>
|
||||||
|
<%= link_to t('admin.menu.poll_booth_assignments'), booth_assignments_admin_polls_path %>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
25
app/views/admin/poll/booth_assignments/manage.html.erb
Normal file
25
app/views/admin/poll/booth_assignments/manage.html.erb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<h2 class="inline-block"><%= t("admin.booths.index.title") %></h2>
|
||||||
|
|
||||||
|
<% 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? %>
|
||||||
|
<div class="callout primary">
|
||||||
|
<%= t("admin.booths.index.no_booths") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if @booths.any? %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th><%= t("admin.booths.index.name") %></th>
|
||||||
|
<th class="text-right"><%= t("admin.actions.actions") %></th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @booths.each do |booth| %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
18
app/views/admin/poll/polls/booth_assignments.html.erb
Normal file
18
app/views/admin/poll/polls/booth_assignments.html.erb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<h2 class="inline-block"><%= t("admin.polls.index.title") %></h2>
|
||||||
|
|
||||||
|
<% if @polls.any? %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th class="medium-6"><%= t("admin.polls.index.name") %></th>
|
||||||
|
<th><%= t("admin.polls.index.dates") %></th>
|
||||||
|
<th class="text-right"><%= t("admin.actions.actions") %></th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%= render @polls %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<div class="callout primary">
|
||||||
|
<%= t("admin.polls.index.no_polls") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -409,6 +409,7 @@ en:
|
|||||||
poll_officers: Poll officers
|
poll_officers: Poll officers
|
||||||
polls: Polls
|
polls: Polls
|
||||||
poll_booths: Booths location
|
poll_booths: Booths location
|
||||||
|
poll_booth_assignments: Booths Assignments
|
||||||
poll_shifts: Manage shifts
|
poll_shifts: Manage shifts
|
||||||
officials: Officials
|
officials: Officials
|
||||||
organizations: Organisations
|
organizations: Organisations
|
||||||
|
|||||||
@@ -420,6 +420,7 @@ es:
|
|||||||
poll_officers: Presidentes de mesa
|
poll_officers: Presidentes de mesa
|
||||||
polls: Votaciones
|
polls: Votaciones
|
||||||
poll_booths: Ubicación de urnas
|
poll_booths: Ubicación de urnas
|
||||||
|
poll_booth_assignments: Asignación de urnas
|
||||||
poll_shifts: Asignar turnos
|
poll_shifts: Asignar turnos
|
||||||
officials: Cargos públicos
|
officials: Cargos públicos
|
||||||
organizations: Organizaciones
|
organizations: Organizaciones
|
||||||
|
|||||||
@@ -273,10 +273,12 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
scope module: :poll do
|
scope module: :poll do
|
||||||
resources :polls do
|
resources :polls do
|
||||||
|
get :booth_assignments, on: :collection
|
||||||
patch :add_question, on: :member
|
patch :add_question, on: :member
|
||||||
|
|
||||||
resources :booth_assignments, only: [:index, :show, :create, :destroy] do
|
resources :booth_assignments, only: [:index, :show, :create, :destroy] do
|
||||||
get :search_booths, on: :collection
|
get :search_booths, on: :collection
|
||||||
|
get :manage, on: :collection
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :officer_assignments, only: [:index, :create, :destroy] do
|
resources :officer_assignments, only: [:index, :create, :destroy] do
|
||||||
|
|||||||
Reference in New Issue
Block a user