Merge pull request #1863 from wairbut-m2c/aperez-fix-for-issue-1848

Add base controller for Admin:Poll controller
This commit is contained in:
BertoCQ
2017-09-19 22:54:14 +02:00
committed by GitHub
10 changed files with 23 additions and 13 deletions

View File

@@ -0,0 +1,10 @@
class Admin::Poll::BaseController < Admin::BaseController
helper_method :namespace
private
def namespace
"admin"
end
end

View File

@@ -1,4 +1,4 @@
class Admin::Poll::BoothAssignmentsController < Admin::BaseController
class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
before_action :load_poll, except: [:create, :destroy]

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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]

View File

@@ -1,4 +1,4 @@
class Admin::Poll::QuestionsController < Admin::BaseController
class Admin::Poll::QuestionsController < Admin::Poll::BaseController
include CommentableActions
load_and_authorize_resource :poll

View File

@@ -1,4 +1,4 @@
class Admin::Poll::RecountsController < Admin::BaseController
class Admin::Poll::RecountsController < Admin::Poll::BaseController
before_action :load_poll
def index

View File

@@ -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

View File

@@ -1,4 +1,4 @@
class Admin::Poll::ShiftsController < Admin::BaseController
class Admin::Poll::ShiftsController < Admin::Poll::BaseController
before_action :load_booth
before_action :load_polls
@@ -57,4 +57,4 @@ class Admin::Poll::ShiftsController < Admin::BaseController
params.require(:shift).permit(:booth_id, :officer_id, :date)
end
end
end