So I’ve submitted another partial-patch to show how we might change
the page editor to support modularization.
Think of it as a completely different approach to accomplishing the
functionality of facets.
The idea is to take all of that usefull html in admin/page/edit.rhtml
and move into individual files under /admin/page/editor/…
As an example, I’ve created _title_fields.rhtml and changed edit.rhtml
to call “<%= editor_title_fields %>” to display it.
Now, this seems pretty simple right? and you may expect an
editor_title_fields to be declared in PageHelper.
Not so… I’d like to be more generic than that. Instead PageHelper
defines method_missing and whenever you call a method that starts with
editor_ it will find the appropriate partial in admin/page/editors
What this means, is that if I want to extend or alter the page editor
title fields, all I need to do is write a helper that defines
editor_title_fields and include that helper in page_controller.
Since method_missing will only be called if the method is not found,
including a helper that explicitly defines editor_title_fields will
free the extension author from dealing with things like
You can of course call the original editor_title_fields in your override
The idea is to replace most of the html in admin/page/edit.rhtml with
calls to partials in this manner. Then, if my extension makes a
really radical change to the page editor, I can provide my own
edit.rhtml and include the page helper to add in the stuff from the
existing page editor that I still need.
A further extension of this idea, would be to allow extensions that
create new page types, to define a single helper that provides the
needed modifications to edit.rhml to support this page type, and the
includsion of this helper would be done automatically for pages of