| Path: | massage/lib/massage.rb |
| Last Update: | Sat Jul 28 15:49:01 +0800 2007 |
| Authors: | Kang-min Liu (gugod@gugod.org), Lukhnos D. Liu (lukhnos@handlino.com) |
| Copyright: | Copyright (c) 2007 Handlino Inc. |
| License: | Distributed under the New BSD License |
Massage is a plugin that makes it very easy to turn your Rails App Into a "single page application" (SPA). An SPA is a Google Mail-like application, in which every controller action is rendered in an HTML element, instead of requiring the flushing of the entire HTML document (ie. page loading).
To enable SPA, simply install the plug-in, and add this line:
spa :only => [:index, :settings] # or :except => [...]
Then when action index or settings is requested as an XHR, the plug-in knows the strip the layout and only render the content into a designated element ("content" by default; changeable).
massage makes use of RJS to enable the SPA techniques. RJS by default requires prototype.js to be included. So make sure it‘s there in your template or layout code.
| DEFAULT_UPDATE_ELEMENT | = | "content" |
| template_exempt_from_layout? | -> | rails_template_exempt_from_layout? |
Turns ("massages") the controller into an SPA-capable controller. This class method adds an around filter to controller actions So they can serve content from both xhr and non-xhr requests.
The options include: