admin global nav
This commit is contained in:
@ -4,7 +4,7 @@ module Admin
|
||||
before_action :collect_quizzes, except: [:login, :auth]
|
||||
|
||||
def index
|
||||
@candidates = policy_scope current_recruiter.candidates
|
||||
@candidates = policy_scope Candidate.order(:name)
|
||||
end
|
||||
|
||||
def new
|
||||
@ -15,7 +15,7 @@ module Admin
|
||||
|
||||
def create
|
||||
authorize Candidate
|
||||
@candidate = Candidate.create(candidate_params.merge(recruiter_id: current_recruiter.id))
|
||||
@candidate = Candidate.create(candidate_params.merge(recruiter_id: current_user.id))
|
||||
|
||||
if @candidate.persisted?
|
||||
send_notifications @candidate
|
||||
|
@ -3,8 +3,25 @@ module Admin
|
||||
class DashboardController < AdminController
|
||||
def show
|
||||
authorize :dashboard
|
||||
@quizzes = policy_scope Quiz.includes(:questions).all
|
||||
@users = policy_scope User.order(:role, :name)
|
||||
send "redirect_for_#{current_user.role}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def redirect_for_admin
|
||||
redirect_to admin_users_url
|
||||
end
|
||||
|
||||
def redirect_for_manager
|
||||
redirect_to admin_quizzes_url
|
||||
end
|
||||
|
||||
def redirect_for_reviewer
|
||||
redirect_to admin_results_url
|
||||
end
|
||||
|
||||
def redirect_for_recruiter
|
||||
redirect_to admin_candidates_url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user