forked from aastucegroup/jquery-editinplace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
58 lines (36 loc) · 2.85 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
INTRODUCTION
------------
editInPlace is a jQuery plugin that turns any element or group of elements
into an Ajax in-place editor using only one line of code. It’s written using the jQuery
library, which is freely available at http://jquery.com.
SUPPORT AND BUG REPORTS
-----------------------
Bug reports, as well as feature requests, may be submitted [on the google code page](http://code.google.com/p/jquery-in-place-editor/issues/list)
QUICK START
-----------
Include jquery and the editin place scripts in your html page (preferably at the bottom so the page loads faster).
<script type="text/javascript" src="path/to/js/jquery.js"></script>
<script type="text/javascript" src="path/to/js/jquery.editinplace.js"></script>
<script type="text/javascript">
$(".inplace-editor").editInPlace({
url: "path/to/server/script.php"
});
</script>
Create a div with the class 'inplace-editor'
<div class="inplace-editor"></div>
Create a server side handler script (php, python, etc...), this example will use php
The following parameters will be sent via a POST requeset to the server script
* update_value
* element_id
* original_html
e.g. in script.php:
$_POST['update_value']
$_POST['element_id']
$_POST['original_html']
Alternatively you can set the option callback, so you can controll the whole saving process yourself (update other parts of the webpage and possibly not even save to the server at all). The editor accepts a wealth of other options to customize how it behaves. They are documented inline [in the sourcecode](lib/jquery.editInPlace.js) and are exposed as $.fn.editInPlace.defaults where you can change them globally for your app. For more examples of how to use the editor, have [a look at the demo html](demo/index.html) and [javascript](demo/js/demo.js).
DOCUMENTATION
-------------
The Editor works in two stages. After initialization it is closed, wich means that it listens to a click on the element it was bound to. When clicked it will open, which means it replaces the content of the bound field with the configured GUI (input, textarea or select), preinitialized to show the value that was shown in that DOM element before. If the user then cancels or doesn't change anything, everything is returned to what it was before. If the user makes a change and commits, that new value is either submitted to the configured URL or to the configured callback and then the editor GUI is again replaced by just the edited value and the editor again listenes to a click.
To support automated acceptance tests better the editor will set the class .editInPlace-active as soon as it opens, and will only remove it when it has finished any interaction with the server or the callback interface has told it so.
More documenataion can be found on [the google code page of this product](http://code.google.com/p/jquery-in-place-editor/)
Thats it! Have fun using it!