Merge branch 'master' into 1856-legislation_processes_proposals_phase
This commit is contained in:
10
app/controllers/admin/poll/base_controller.rb
Normal file
10
app/controllers/admin/poll/base_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class Admin::Poll::BaseController < Admin::BaseController
|
||||
helper_method :namespace
|
||||
|
||||
private
|
||||
|
||||
def namespace
|
||||
"admin"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::BoothAssignmentsController < Admin::BaseController
|
||||
class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
||||
|
||||
before_action :load_poll, except: [:create, :destroy]
|
||||
|
||||
@@ -15,7 +15,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def show
|
||||
@booth_assignment = @poll.booth_assignments.includes(:final_recounts, :voters,
|
||||
@booth_assignment = @poll.booth_assignments.includes(:total_results, :voters,
|
||||
officer_assignments: [officer: [:user]]).find(params[:id])
|
||||
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::BoothsController < Admin::BaseController
|
||||
class Admin::Poll::BoothsController < Admin::Poll::BaseController
|
||||
load_and_authorize_resource class: 'Poll::Booth'
|
||||
|
||||
def index
|
||||
@@ -41,4 +41,4 @@ class Admin::Poll::BoothsController < Admin::BaseController
|
||||
params.require(:poll_booth).permit(:name, :location)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
|
||||
class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
|
||||
|
||||
before_action :load_poll
|
||||
before_action :redirect_if_blank_required_params, only: [:by_officer]
|
||||
@@ -18,7 +18,7 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
|
||||
@officer = ::Poll::Officer.includes(:user).find(officer_assignment_params[:officer_id])
|
||||
@officer_assignments = ::Poll::OfficerAssignment.
|
||||
joins(:booth_assignment).
|
||||
includes(:final_recounts, booth_assignment: :booth).
|
||||
includes(:total_results, booth_assignment: :booth).
|
||||
where("officer_id = ? AND poll_booth_assignments.poll_id = ?", @officer.id, @poll.id).
|
||||
order(:date)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::OfficersController < Admin::BaseController
|
||||
class Admin::Poll::OfficersController < Admin::Poll::BaseController
|
||||
load_and_authorize_resource :officer, class: "Poll::Officer", except: [:edit, :show]
|
||||
|
||||
def index
|
||||
@@ -36,4 +36,4 @@ class Admin::Poll::OfficersController < Admin::BaseController
|
||||
def edit
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::PollsController < Admin::BaseController
|
||||
class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
load_and_authorize_resource
|
||||
|
||||
before_action :load_search, only: [:search_booths, :search_questions, :search_officers]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::QuestionsController < Admin::BaseController
|
||||
class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
||||
include CommentableActions
|
||||
|
||||
load_and_authorize_resource :poll
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class Admin::Poll::RecountsController < Admin::BaseController
|
||||
class Admin::Poll::RecountsController < Admin::Poll::BaseController
|
||||
before_action :load_poll
|
||||
|
||||
def index
|
||||
@booth_assignments = @poll.booth_assignments.
|
||||
includes(:booth, :final_recounts, :voters).
|
||||
includes(:booth, :total_results, :voters).
|
||||
order("poll_booths.name").
|
||||
page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::Poll::ResultsController < Admin::BaseController
|
||||
class Admin::Poll::ResultsController < Admin::Poll::BaseController
|
||||
before_action :load_poll
|
||||
|
||||
def index
|
||||
@@ -10,4 +10,4 @@ class Admin::Poll::ResultsController < Admin::BaseController
|
||||
def load_poll
|
||||
@poll = ::Poll.includes(:questions).find(params[:poll_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Admin::Poll::ShiftsController < Admin::BaseController
|
||||
|
||||
class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
||||
|
||||
before_action :load_booth
|
||||
before_action :load_polls
|
||||
before_action :load_officer
|
||||
@@ -57,4 +57,4 @@ class Admin::Poll::ShiftsController < Admin::BaseController
|
||||
params.require(:shift).permit(:booth_id, :officer_id, :date)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user