Update read me to reflect the new event names.

This commit is contained in:
Nathan Van der Auwera 2012-09-25 00:47:41 +02:00
parent 5d2446f7e5
commit 7e830eea2e

View File

@ -264,10 +264,10 @@ Optionally you could also leave out the name and supply a block that is captured
On insertion or removal the following events are triggered: On insertion or removal the following events are triggered:
* `before-insert.cocoon`: called before inserting a new nested child * `cocoon:before-insert`: called before inserting a new nested child
* `after-insert.cocoon`: called after inserting * `cocoon:after-insert`: called after inserting
* `before-remove.cocoon`: called before removing the nested child * `cocoon:before-remove`: called before removing the nested child
* `after-remove.cocoon`: called after removal * `cocoon:after-remove`: called after removal
If in your view you have the following snippet to select an `owner` If in your view you have the following snippet to select an `owner`
(we use slim for demonstration purposes) (we use slim for demonstration purposes)
@ -286,21 +286,21 @@ The callbacks can be added as follows:
````javascript ````javascript
$(document).ready(function() { $(document).ready(function() {
$('#owner').bind('before-insert.cocoon', $('#owner').bind('cocoon:before-insert',
function() { function() {
$("#owner_from_list").hide(); $("#owner_from_list").hide();
$("#owner a.add_fields").hide(); $("#owner a.add_fields").hide();
}); });
$('#owner').bind('after-insert.cocoon', $('#owner').bind('cocoon:after-insert',
function() { function() {
/* ... do something ... */ /* ... do something ... */
}); });
$('#owner').bind("before-remove.cocoon", $('#owner').bind("cocoon:before-remove",
function() { function() {
$("#owner_from_list").show(); $("#owner_from_list").show();
$("#owner a.add_fields").show(); $("#owner a.add_fields").show();
}); });
$('#owner').bind("after-remove.cocoon", $('#owner').bind("cocoon:after-remove",
function() { function() {
/* e.g. recalculate order of child items */ /* e.g. recalculate order of child items */
}); });