README.md in x-editable-rails-0.0.3 vs README.md in x-editable-rails-1.0.0
- old
+ new
@@ -19,37 +19,54 @@
## Usage
Insert files to your application
```coffee
-#= require bootstrap-editable
+#= require editable/bootstrap-editable
```
-or
+You can choose between bootstrap-editable/jqueryui-editable/jquery-editable-poshytip
+
+```scss
+*= require editable/bootstrap-editable
+```
+You can choose between bootstrap-editable/jqueryui-editable/jquery-editable
+
+
+You can also insert this file
```coffee
-#= require bootstrap-editable-inline
+#= require editable/rails
```
-You can choose between bootstrap/jqueryui/jquery and inline version
+This is simple helper using CanCan
-And this to your stylesheets
+First you need to create simple helper, which returns true or false (if is editable enabled or not)
-```scss
-*= require bootstrap-editable
+```ruby
+def xeditable?
+ true # Or something like current_user.xeditable?
+end
```
-Choose between bootstrap/jqueryui/jquery
+and this is how to use helper method
-You can also insert this file
-```coffee
-#= require rails-editable
+```ruby
+%h1= editable Page, @page, 'name', e: @page.name
+# editable Model, object, what_you_want_update, e: exception - when is xeditable? false or can? :edit, Model is false
```
-And you'll be able update everything directly.
+
+or with nested attributes (globalize3 example)
+```ruby
+%h1= editable Page, @page, 'name', nested: 'translations', nid: @page.translation.id, e: @page.name
+# nested: nested attributes, nid: id of nested attribute
+```
+
+You can also update everything directly.
```haml
-%a{href: "#", class: "editable",'data-type' => 'text', 'data-model' => "post", 'data-name' => "name", 'data-url' => post_path(post), 'data-original-title' => "Your info here"}= post.name
+%a{href: '#', class: 'editable', data: { type: 'text', model: 'post', name: 'name', url: post_path(post), 'original-title' => 'Your info here'}}= post.name
```
or if nested
```haml
-%a{href: "#", class: "editable",'data-type' => 'text', 'data-model' => "post", 'data-nested' => 'post_translations', 'data-name' => "name", 'data-nid' => "#{post.translation.id}", 'data-url' => post_path(post), 'data-original-title' => "Your info here"}= post.name
+%a{href: '#', class: 'editable', data: { type: 'text', model: 'post', nested: 'translations', name: 'name', nid: '#{post.translation.id}', url: post_path(post), 'original-title' => 'Your info here'}}= post.name
```
You need to specify:
1. data-model
2. data-name