# Core Dev: Page Controller and Page Editor refactorings (part

**URL:** <https://www.ruby-forum.com/t/core-dev-page-controller-and-page-editor-refactorings-part/105939>\
**Category:** Radiant CMS\
**Created:** [June 4, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/core-dev-page-controller-and-page-editor-refactorings-part/105939 "2007-06-04T20:35:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![igotimac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@igotimac](https://www.ruby-forum.com/u/igotimac)\
**Post date:** [June 4, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/core-dev-page-controller-and-page-editor-refactorings-part/105939/1 "2007-06-04T20:35:59Z")

</div>

Hi,

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  
alias\_method\_chain

You can of course call the original editor\_title\_fields in your override  
with  
render\_editor\_partial(‘title\_fields’)

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  
that type.

What do you think?  
[http://dev.radiantcms.org/radiant/attachment/ticket/508/page\_editor\_modularization.diff](http://dev.radiantcms.org/radiant/attachment/ticket/508/page_editor_modularization.diff)

Jacob
