-
Notifications
You must be signed in to change notification settings - Fork 0
/
TOOLS
32 lines (25 loc) · 1.1 KB
/
TOOLS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
= Crabgrass Tools
This is documentation specific to Crabgras Tools.
A tool can do pretty much anything. It can be an entire rails
application. However, the typical case is that whenever a Page of the
type defined in the tool is to be shown, then crabgrass will use the
controllers and views defined in that tool.
How does it know? Because of a call like this placed in the init.rb of
the tool:
PageClassRegistrar.add(
'WikiPage',
:controller => 'wiki_page',
:model => 'Wiki',
:icon => 'wiki.png',
:class_display_name => 'wiki',
:class_description => 'A free-form text document.',
:class_group => 'wiki'
)
In this example, whenever a page of type WikiPage is displayed, the
controller WikiPageController will be called (derived from the
camelcase of :controller). This could live anywhere, but we happen to
have bundled this controller in the tool under:
tools/wiki_tool/app/controllers/wiki_page_controller.rb
Tools page controllers should not override BasePageController#create method,
instead override BasePageController#build_page_data and
BasePageController#destroy_page_data methods.