README.md in abracadabra-1.0.2 vs README.md in abracadabra-1.0.3
- old
+ new
@@ -18,10 +18,12 @@
$ gem install abracadabra
## Usage
+* Requires JQuery, JQuery-UJS (rails.js), Bootstrap and Font-Awesome (unless you override the framework specific classes with CSS)
+
In your `application.css`, AFTER Bootstrap (currently only supports Bootstrap), include the css file:
```css
*= require abracadabra
```
@@ -38,31 +40,57 @@
```ruby
<%= click_to_edit @user, path: user_path(@user), attribute: :name %>
```
-When a user clicks the link generated by this helper, a form with a text field input will replace the link. It's fully Rails compliant, and looks identical to a `form_for` with `remote: true`. Currently, it only responds to javascript, but other datatypes will be supported soon. Here's what it looks like:
+When a user clicks the link generated by this helper, a form with a text field input will replace the link. It's fully Rails compliant, and looks identical to a `form_for` with `remote: true`. Here's what it looks like:
-[Video of abracadabra in action!](http://recordit.co/cpwdWIyEN4)
+![Abracadabra Demo](http://recordit.co/CbgPTahYix.gif "Abracadabra Demo")
-The first parameter is the object to be edited, and the only other required parameters are `path` and `attribute`. `path` specifies where the form will be submitted, and `attribute` specifies the column being updated.
+The first parameter of `click_to_edit` is the object to be edited, and the only other required parameters are `path` and `attribute`. `path` specifies where the form will be submitted, and `attribute` specifies the column being updated.
-It accepts the following optional hash keys (more will be added soon):
+It accepts the following parameters:
```ruby
+### REQUIRED ###
+path: user_path(@user)
+# Specifies where the form will be submitted.
+
+attribute: :name
+# Specifies what attribute your text field will be updating.
+
+
+### OPTIONAL ###
class: "my-class"
-# A class to be added to the text input of the form.
+# Class(es) to be added to the text input of the form. The class "abracadabra" is added either way.
+# Default: only "abracadabra"
value: "blah"
# An alternate value, other than what object.attribute would return.
+# Default: object.attribute
method: "patch"
# HTTP REST method to use. Use anything but "get".
+# Default: "patch"
+
+remote: true
+# Same as link_to's remote: true, form submits via AJAX.
+# Default: true
+
+# IMPORTANT: `type` will be ignored if `remote = false` is used. HTML is the default
+# in Rails for standard form submissions.
+type: :js
+# Content type -- responds to any content types (:js and :script can both be used to respond with Javascript).
+# Default: :script (:js)
```
## Future & Contributing
-I would love anyone to add date pickers and other alternate field types to this. Any other ideas, feel free to contribute!
+1. I would love anyone to add date pickers and other alternate field types to this.
+
+2. I would love the different Bootstrap classes to be overridable with an initializer (config/abracadabra.rb) so that any framework could be used. Same with the Font-Awesome button classes.
+
+Any other ideas, feel free to contribute!
1. Fork it ( http://github.com/TrevorHinesley/abracadabra/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)