Fixes #1848 On branch aperez-fix-for-issue-1848 Changes to be committed: new file: app/controllers/admin/poll/base_controller.rb modified: app/controllers/admin/poll/booth_assignments_controller.rb modified: app/controllers/admin/poll/booths_controller.rb modified: app/controllers/admin/poll/officer_assignments_controller.rb modified: app/controllers/admin/poll/officers_controller.rb modified: app/controllers/admin/poll/polls_controller.rb modified: app/controllers/admin/poll/questions_controller.rb modified: app/controllers/admin/poll/recounts_controller.rb modified: app/controllers/admin/poll/results_controller.rb modified: app/controllers/admin/poll/shifts_controller.rb
45 lines
805 B
Ruby
45 lines
805 B
Ruby
class Admin::Poll::BoothsController < Admin::Poll::BaseController
|
|
load_and_authorize_resource class: 'Poll::Booth'
|
|
|
|
def index
|
|
@booths = @booths.order(name: :asc).page(params[:page])
|
|
end
|
|
|
|
def show
|
|
end
|
|
|
|
def new
|
|
end
|
|
|
|
def create
|
|
if @booth.save
|
|
redirect_to admin_booths_path, notice: t("flash.actions.create.poll_booth")
|
|
else
|
|
render :new
|
|
end
|
|
end
|
|
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
if @booth.update(booth_params)
|
|
redirect_to admin_booth_path(@booth), notice: t("flash.actions.update.poll_booth")
|
|
else
|
|
render :edit
|
|
end
|
|
end
|
|
|
|
def available
|
|
@booths = Poll::Booth.available.order(name: :asc).page(params[:page])
|
|
render :index
|
|
end
|
|
|
|
private
|
|
|
|
def booth_params
|
|
params.require(:poll_booth).permit(:name, :location)
|
|
end
|
|
|
|
end
|