Module Apotomo::WidgetShortcuts
In: lib/apotomo/widget_shortcuts.rb

Create widget trees using the widget DSL.

Methods

widget  

Classes and Modules

Module Apotomo::WidgetShortcuts::DSL
Class Apotomo::WidgetShortcuts::FactoryProxy

Public Instance methods

Shortcut for creating an instance of class_name+"_widget" named id. Yields self. Note that this creates a proxy object, only. The actual widget is built not until you added it, e.g. using #<<.

Example:

  root << widget(:comments)

will create a CommentsWidget with id :comments attached to root.

  widget(:comments, 'post-comments', :user => current_user)

sets id to ‘posts_comments’ and options to the hash.

You can also use namespaces.

  widget('jquery/tabs', 'panel')

Add a block if you need to grab the created widget right away.

  root << widget(:comments) do |comments|
    comments.markdown!
  end

Using widget is just a shortcut, you can always use the constructor as well.

  CommentsWidget.new(root, :comments)

[Validate]