Radiant Facets


#1

The Facets model of Extensions is to break up the page editing interpace
into regions and parts.

To alter this interface you insert your “part” somewhere into this
hierarchy. Or you can re-arrange the hierarchy.

So for example you would do something like:

Radiant::PageEditorUI.add "admin/page/attributes", :region => :form,

:after => “edit_page_parts”
Radiant::PageEditorUI.add “admin/page/popups”, :region => :popups

The problem with this model is that extensions don’t always want to add
just
one button somewhere… sometimes we want to change the organization of
the
page editor. We want the freedom to write HTML. So I propose that
instead
of making this call in activate, you instead name a partial in your
extension as the page editor. Ideally, you should be able to name this
as
the partial to use for only certain page types.

something like the following declaration in my extension:
Radient::PageEditorUI.define_page_editor do
| user, session, default |
if user.admin?
‘admin/page/my_special_admin_editor’
else
default
end
end
where define_page_editor is a core method that allows me to specify a
block
that can conditionally determine which page editor should be used.

The definition of this partial (my_special_admin_editor) should be to
call
all the built in radiant page editor partials, and override / replace /
reformat as needed

So for example you would do something like:

    <%=page_editor_render :edit_form" do %>
        <%=page_editor_render :edit_title"%>
        <%=page_editor_render :edit_extended_metadata"%>
        <%=page_editor_render :edit_page_parts"%>
            <%=render :partial => 'admin/page/attributes'%>
        <%=page_editor_render :edit_layout_and_type"%>
        <%=page_editor_render :edit_timestamp"%>
        <%=page_editor_render :edit_buttons"%>
    <% end %>
    <%=page_editor_render :edit_popups" do %>
            <%=render :partial => 'admin/page/popups'%>
    <% end %>

This would allow you to mix in all the HTML etc needed to properly
format
these pieces together for your particular setup. This would also give
you
the flexibility to solve the problems that will arise when multiple
extensions want to change the editor.