Permalink
Newer
Older
100644 28 lines (20 sloc) 787 Bytes
marcoribi
Aug 11, 2008
1
Inplace
2
=======
3
marcoribi
Aug 11, 2008
4
= What is it
marcoribi
Aug 11, 2008
5
Inplace is a simple RESTful in place editor based and tested on Rails 2.1.0.
marcoribi
Aug 11, 2008
6
marcoribi
Aug 11, 2008
7
= Installation
8
script plugin/install ...
marcoribi
Aug 11, 2008
9
marcoribi
Aug 11, 2008
10
= Usage
marcoribi
Aug 11, 2008
11
In your View:
12
<%= editable_content_tag(:span, @artist, 'name', true, nil, {:style => 'border: 1px solid grey;'}, {:okText => 'save it'}) %>
13
14
In your Controller:
15
16
if @artist.update_attributes(params[:artist])
17
format.html { redirect_to(@artist) }
18
format.json { render :json => @artist }
19
else
20
format.html { render :action => "edit" }
21
format.json { render :json => @artist, :status => SOMETHINGELSE_THAN_200}
22
end
23
24
Based on work by Rick: http://www.bizmeetsdev.com/articles/2008/02/09/editable_content_tag
25
Thanks a lot!
26
marcoribi
Aug 11, 2008
27
Copyright (c) 2008 [Simplificator GmbH - www.simplificator.com], released under the MIT license