admin global nav

This commit is contained in:
Mark Moser
2016-09-22 16:29:19 -05:00
parent aeef75bf8b
commit 5398a8ea8b
14 changed files with 64 additions and 67 deletions

View File

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

View File

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