2020-05-11 17:37:22 +00:00
|
|
|
# All Administrate controllers inherit from this
|
|
|
|
# `Administrate::ApplicationController`, making it the ideal place to put
|
|
|
|
# authentication logic or other before_actions.
|
|
|
|
#
|
|
|
|
# If you want to add pagination or other controller-level concerns,
|
|
|
|
# you're free to overwrite the RESTful controller actions.
|
|
|
|
class SuperAdmin::ApplicationController < Administrate::ApplicationController
|
|
|
|
# authenticiation done via devise : SuperAdmin Model
|
|
|
|
before_action :authenticate_super_admin!
|
|
|
|
|
|
|
|
# Override this value to specify the number of elements to display at a time
|
|
|
|
# on index pages. Defaults to 20.
|
|
|
|
# def records_per_page
|
|
|
|
# params[:per_page] || 20
|
|
|
|
# end
|
2020-05-24 17:14:26 +00:00
|
|
|
|
|
|
|
def order
|
|
|
|
@order ||= Administrate::Order.new(
|
|
|
|
params.fetch(resource_name, {}).fetch(:order, 'id'),
|
|
|
|
params.fetch(resource_name, {}).fetch(:direction, 'desc')
|
|
|
|
)
|
|
|
|
end
|
2020-05-11 17:37:22 +00:00
|
|
|
end
|