class ActiveAdmin::Page
Page
is the primary data storage for page configuration in Active Admin
When you register a page (ActiveAdmin.register_page “Status”) you are actually creating a new Page
instance within the given Namespace
.
The instance of the current page is available in PageController
and views by calling the active_admin_config method.
Attributes
name[R]
The name of the page
namespace[R]
The namespace this config belongs to
page_actions[R]
An array of custom actions defined for this page
Public Instance Methods
add_default_action_items()
click to toggle source
# File lib/active_admin/page.rb, line 77 def add_default_action_items end
belongs_to(target, options = {})
click to toggle source
# File lib/active_admin/page.rb, line 88 def belongs_to(target, options = {}) @belongs_to = Resource::BelongsTo.new(self, target, options) self.navigation_menu_name = target unless @belongs_to.optional? controller.send :belongs_to, target, options.dup end
belongs_to?()
click to toggle source
Do we belong to another resource?
# File lib/active_admin/page.rb, line 99 def belongs_to? !!belongs_to_config end
belongs_to_config()
click to toggle source
# File lib/active_admin/page.rb, line 94 def belongs_to_config @belongs_to end
camelized_resource_name()
click to toggle source
# File lib/active_admin/page.rb, line 56 def camelized_resource_name underscored_resource_name.camelize end
clear_page_actions!()
click to toggle source
Clears all the custom actions this page knows about
# File lib/active_admin/page.rb, line 84 def clear_page_actions! @page_actions = [] end
controller_name()
click to toggle source
# File lib/active_admin/page.rb, line 68 def controller_name [namespace.module_name, camelized_resource_name + "Controller"].compact.join("::") end
namespace_name()
click to toggle source
# File lib/active_admin/page.rb, line 60 def namespace_name namespace.name.to_s end
order_clause()
click to toggle source
# File lib/active_admin/page.rb, line 107 def order_clause @order_clause || namespace.order_clause end
plural_resource_label()
click to toggle source
label is singular
# File lib/active_admin/page.rb, line 44 def plural_resource_label name end
resource_name()
click to toggle source
# File lib/active_admin/page.rb, line 48 def resource_name @resource_name ||= Resource::Name.new(nil, name) end
route_uncountable?()
click to toggle source
Override from ‘ActiveAdmin::Resource::Controllers`
# File lib/active_admin/page.rb, line 73 def route_uncountable? false end
underscored_resource_name()
click to toggle source
# File lib/active_admin/page.rb, line 52 def underscored_resource_name resource_name.to_s.parameterize.underscore end