Skip to content

Commit 4dd9190

Browse files
pcreuxgregbell
authored andcommitted
Add comments to Page & Resource's Config and Controllers
1 parent 54379ae commit 4dd9190

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

lib/active_admin/base_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require 'active_admin/base_controller/page_configurations'
44

55
module ActiveAdmin
6+
# BaseController for ActiveAdmin.
7+
# It implements ActiveAdmin controllers core features.
68
class BaseController < ::InheritedResources::Base
79
helper ::ActiveAdmin::ViewHelpers
810

lib/active_admin/config.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ class Config; end
66
require 'active_admin/config/menu'
77

88
module ActiveAdmin
9+
10+
# Config implements the common API to Page and Resource.
11+
#
912
class Config
1013
# The namespace this config belongs to
1114
attr_reader :namespace

lib/active_admin/page.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
module ActiveAdmin
2+
# Page is the primary data storage for page configuration in Active Admin
3+
#
4+
# When you register a page (ActiveAdmin.page "Status") you are actually creating
5+
# a new Page instance within the given Namespace.
6+
#
7+
# The instance of the current page is available in PageController and views
8+
# by calling the #active_admin_config method.
9+
#
210
class Page < Config
311
attr_reader :name
412

lib/active_admin/page_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
module ActiveAdmin
2-
# Note: I could try to just inherit from ResourceController
2+
3+
# All Pages controllers inherit from this controller.
34
class PageController < BaseController
45

5-
layout false # Page page is a subclass of Base page.
6+
# Pages::Page subclasses Page::Base which implements the layout code
7+
layout false
68

79
actions :index
810

lib/active_admin/resource_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
require 'active_admin/resource_controller/scoping'
99

1010
module ActiveAdmin
11+
# All Resources Controller inherits from this controller.
12+
# It implements actions and helpers for resources.
1113
class ResourceController < BaseController
1214
layout :determine_active_admin_layout
1315

spec/unit/namespace_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,5 +318,5 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end
318318
end
319319
end # describe "setting a condition for displaying"
320320
end # describe "adding to the menu"
321-
end
321+
end # describe "registering a page"
322322
end

0 commit comments

Comments
 (0)