adds available booths
This commit is contained in:
@@ -30,6 +30,11 @@ class Admin::Poll::BoothsController < Admin::BaseController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def available
|
||||||
|
@booths = Poll::Booth.available.order(name: :asc).page(params[:page])
|
||||||
|
render :index
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def booth_params
|
def booth_params
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module Abilities
|
|||||||
can [:index, :create, :edit, :update, :destroy], Geozone
|
can [:index, :create, :edit, :update, :destroy], Geozone
|
||||||
|
|
||||||
can [:read, :create, :update, :destroy, :add_question, :remove_question, :search_booths, :search_questions, :search_officers], Poll
|
can [:read, :create, :update, :destroy, :add_question, :remove_question, :search_booths, :search_questions, :search_officers], Poll
|
||||||
can [:read, :create, :update, :destroy], 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], ::Poll::BoothAssignment
|
||||||
can [:create, :destroy], ::Poll::OfficerAssignment
|
can [:create, :destroy], ::Poll::OfficerAssignment
|
||||||
|
|||||||
@@ -10,5 +10,10 @@ class Poll
|
|||||||
return Booth.none if terms.blank?
|
return Booth.none if terms.blank?
|
||||||
Booth.where("name ILIKE ? OR location ILIKE ?", "%#{terms}%", "%#{terms}%")
|
Booth.where("name ILIKE ? OR location ILIKE ?", "%#{terms}%", "%#{terms}%")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.available
|
||||||
|
where(polls: { id: Poll.current_or_incoming }).includes(:polls)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -287,6 +287,8 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
resources :booths do
|
resources :booths do
|
||||||
|
get :available, on: :collection
|
||||||
|
|
||||||
resources :shifts
|
resources :shifts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user