It's been a long time coming, but here it is.

** The facets branch functionality is now available as an extension! **

http://dev.radiantcms.org/svn/radiant/trunk/extensions/shards

The latest contract I've been working on is using Radiant, and they 
needed this functionality.  The extension will work on 0.6.2, but I 
highly recommend using edge for the sake of bugfixes.

There have been some significant changes in the API that I should warn 
you about if you used the facets branch before:

* 'facets-lite' is still supported.  Existing extensions that use this 
should not break.
* Some of the region names may have been changed or added.
* There are no more 'plain' partials.  Everything exists in a region or 
is rendered directly from a template.
* Use content_for :page_scripts and content_for :page_css to insert 
inline Javascripts and CSS, respectively.  content_for appends to its 
result anyway, so it was not necessary to keep 'additional_javascripts' 
and 'additional_styles' in the API.  If you have external files, you can 
still use 'include_javascript' and 'include_stylesheet'.
* Regions are still accessible from the 'admin' object, but are accessed 
like so:

  # The RegionSet for the page edit screen.
  admin.page.edit

  # The array of partials in the 'main' region.
  admin.page.edit.main
  admin.page.edit[:main] # equivalent
   admin.page.edit['main'] # equivalent

  # Adds the 'foo' partial to the main region, before the 'edit_form' 
partial
  admin.page.edit.add :main, 'foo', :before => 'edit_form'

  # Adds the 'foo' partial to the main region, after the 'edit_header' 
partial
  admin.page.edit.add :main, 'foo', :after => 'edit_header'

* Regions are blank by default, so you can reference a region without it 
being pre-existing.
* Any controller/action may have regions that are rendered.  These are 
determined by the controller name and template name.  See the 
implementation of the 'render_region' helper for details.
* If you want to add your own controllers and actions/templates, add an 
attr_accessor to Radiant::AdminUI with the controller name, fill that 
attribute with an OpenStruct, then assign Shards::RegionSet objects to 
the struct by template name.  For example, if I have an "events" 
controller and I want to add regions to its "index" template, I would do 
this in the 'activate' method of my extension:

  Radiant::AdminUI.class_eval { attr_accessor :events }
  admin.events = OpenStruct.new
  admin.events.index = Shards::RegionSet.new

You can pass a block to RegionSet.new, which will yield itself to the block.

* The only pages that can be modified out-of-box at the moment are:
   - Page edit/new (as before)
   - Page index (limited)

The core of the API is pretty solid and well tested, but I would 
entertain any patches that extend the reach into the other areas of the 
administration interface.

Cheers,

Sean
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to