Sign In
Start Page | Recent Changes | All Pages | Orphan Pages | Junebug Help

Using the Shards Extension

What is Shards?

Shards is a Radiant extension that allows other extension developers to modify aspects of Radiant’s default administration interface. It does this by deconstructing each view template into hierarchical component pieces called “regions”. A developer may insert or remove view partials from these regions from an extension. This permits:

  • Adding new user interface elements
  • Removing or replacing user interface elements
  • Customizing appearance using CSS
  • Customizing UI behavior with Javascript

Basic usage

Shards regions are accessible from the Radiant::AdminUI object, which is simply named “admin” inside an extension class. They are organized first by controller name, then by action name, and then by region. For example, if I wanted to add a partial called “tags” to the “form_bottom” region of the Page editing screen, in my extension’s activate method, I would do this:

  admin.page.edit.add :form_bottom, "tags"

The add method also allows you to insert partials in specific orders, i.e. before or after an existing partial. Examples:

  admin.page.edit.add :main, "help_links", :before => "edit_header" 
  admin.page.edit.add :form_area, "categories", :after => "edit_page_parts"

Alternatively, you may access a given region directly using a dot or bracket accessor. Regions are essentially arrays of partial names.

  admin.page.edit.form_area
  admin.page.edit['form_area']
  admin.page.edit[:form_area]

Regions structure

Below is a tree of the current structure of regions partials in Shards. You may also discover this by reading the source of shards_extension.rb. It is listed by controller and action(s). Regions are in brackets.

Admin::PageController

#new, #edit (and #add_part)

  • [main]
    • edit_header
    • edit_form
      • [form_top]
      • [form]
        • edit_title
        • edit_extended_metadata (@meta)
        • edit_page_parts
          • part
            • [part_controls]
          • [parts_bottom]
            • edit_layout_and_type
            • edit_timestamp
      • [form_bottom]
        • edit_buttons (@buttons_partials)
    • edit_popups
      • [popups]
  • edit_scripts_and_styles

#index (#children, and #remove)

TODO

Admin::SnippetController

#new, #edit

TODO

Admin::LayoutController

#new, #edit

TODO


Version 5 | Other versions: « older newer » current versions
Page last edited by seancribbs on August 26, 2008 01:10 PM (diff)