Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (42 sloc) 1.23 KB
module ActiveAdmin
module Dashboards
class DashboardController < ResourceController
actions :index
def index
@dashboard_sections = find_sections
render 'active_admin/dashboard/index.html.arb'
end
protected
def set_current_tab
@current_tab = I18n.t("active_admin.dashboard")
end
def find_sections
sections = ActiveAdmin::Dashboards.sections_for_namespace(namespace)
sections.select do |section|
if section.options.has_key?(:if)
symbol_or_proc = section.options[:if]
case symbol_or_proc
when Symbol, String then self.send(symbol_or_proc)
when Proc then instance_exec(&symbol_or_proc)
else symbol_or_proc
end
else
true
end
end
end
def namespace
class_name = self.class.name
if class_name.include?('::')
self.class.name.split('::').first.underscore.to_sym
else
:root
end
end
# Return the current menu for the view. This is a helper method
def current_menu
ActiveAdmin.application.namespaces[namespace].menu
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.