REST in Place plugin
Plugin details
Documentation
ruby script/plugin install http://svn.varwig.org/rails/plugins/rest_in_place/
REST in Place needs the jQuery library to work.
To make a piece of Text inplace-editable, wrap it into an element (a span usually) with class "rest_in_place". The editor needs 3 pieces of information to work: a URL, an object name and the attribute name. These are provided as follows:
put attributes into the element, like this:
span class="rest_in_place" url="/users/1" object="user" attribute="name" Johnny /span
if any of these attributes is missing, DOM parents of the elemet are searched for them. That means you can write something like:
div object="user" url="/users/1" Name: span class="rest_in_place" attribute="name" >Johnny/span eMail: span class="rest_in_place" attribute="email">johnny@somehost.com/span /div
You can completely omit the url, the current documents url is taken then. With proper RESTful controllers this should always work, the url-attribute is for cases when you want to edit a resource that is displayed as part of a non-RESTful webpage.
Rails provides the dom_id helper that constructs a dom id out of an ActiveRecord for you. So, your HTML page may look like this:
div> id="user_1" Name: span> class="rest_in_place" attribute="name" >Johnny /span> eMail: span> class="rest_in_place" attribute="email">johnny@somehost.com /span> /div>
REST in Place recognizes dom_ids of this form and derives the object parameter from them, so that (with the current documents url used) you really only need to provide the attributes name in most cases.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: Guest, 4 months ago

