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 76 def add_default_action_items end
belongs_to(target, options = {})
click to toggle source
# File lib/active_admin/page.rb, line 87 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 98 def belongs_to? !!belongs_to_config end
belongs_to_config()
click to toggle source
# File lib/active_admin/page.rb, line 93 def belongs_to_config @belongs_to end
camelized_resource_name()
click to toggle source
# File lib/active_admin/page.rb, line 55 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 83 def clear_page_actions! @page_actions = [] end
controller_name()
click to toggle source
# File lib/active_admin/page.rb, line 67 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 59 def namespace_name namespace.name.to_s end
order_clause()
click to toggle source
# File lib/active_admin/page.rb, line 106 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 43 def plural_resource_label name end
resource_name()
click to toggle source
# File lib/active_admin/page.rb, line 47 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 72 def route_uncountable? false end
underscored_resource_name()
click to toggle source
# File lib/active_admin/page.rb, line 51 def underscored_resource_name resource_name.to_s.parameterize.underscore end