dashboard controller
This commit is contained in:
10
app/controllers/admin/dashboard_controller.rb
Normal file
10
app/controllers/admin/dashboard_controller.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
module Admin
|
||||
class DashboardController < AdminController
|
||||
def show
|
||||
authorize :dashboard
|
||||
@quizzes = policy_scope Quiz.includes(:questions).all
|
||||
@users = policy_scope User.order(:role, :name)
|
||||
end
|
||||
end
|
||||
end
|
@ -4,17 +4,10 @@ class AdminController < ApplicationController
|
||||
layout 'admin'
|
||||
before_action :authorize_user
|
||||
|
||||
after_action :verify_authorized, except: :index
|
||||
after_action :verify_policy_scoped, only: :index
|
||||
|
||||
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
||||
|
||||
# TODO: move to DashboardController#index
|
||||
def dashboard
|
||||
authorize :admin, :dashboard?
|
||||
@quizzes = Quiz.includes(:questions).all
|
||||
@users = User.order(:role, :name)
|
||||
end
|
||||
after_action :verify_authorized, except: :index
|
||||
after_action :verify_policy_scoped, only: :index
|
||||
|
||||
def current_user
|
||||
@current_user ||= User.find_by(id: session[:user]) if session[:user]
|
||||
|
Reference in New Issue
Block a user