ruhoh/ruhoh.rb — pull request #65 by lynnfaraday (2012-07-18 05:39:57+00:00)
Title: Widget Enhancements - Helpers and Context

This pull request addresses issues #52 and #53.

**Widget Helpers**

Widgets can now have Ruby helpers, which should be located in a 'helpers' folder under the widget and named with the ".rb" extension.

widgets
my_widget
helpers
my_widget.rb
javascripts
layouts

*Note: This blurs the line between what is a 'plugin' and what is a 'widget', but I'm not sure if that's bad. By allowing you to do both, I think it offers more flexibility.*

**Widget Context**

Widget layouts now have access to the current page context, just like other layouts and partials.

*Note: As a side effect of this, the special "{{config}}" that widgets used to have passed directly is now part of the global payload under "{{widgets.widget_name.config}}" There's an easy way to fix this, so that {{config}} is there for backwards-compatibility, but since I knew you were fixing up the widget config references somewhat in the next release anyway, I wasn't sure it was a big deal.*