README.md in dynaspan-0.1.3 vs README.md in dynaspan-0.1.4
- old
+ new
@@ -1,6 +1,6 @@
-##Dynaspan
+##Dynaspan - The magic AJAX just happens!
[![Gem Version](https://badge.fury.io/rb/dynaspan.svg)](http://badge.fury.io/rb/dynaspan)
[![Code Climate](https://codeclimate.com/github/danielpclark/dynaspan/badges/gpa.svg)](https://codeclimate.com/github/danielpclark/dynaspan)
#####[JSFiddle Demo](http://jsfiddle.net/680v09y8/)
Dynaspan is an AJAX tool for Rails to update one field of any object without interfering with your website experience. The user will see the web page as normal text. Where ever you've placed a Dynaspan field people can click on the text and it transforms into text entry. As soon as the person moves away from that entry it sends the update to the server.
@@ -44,10 +44,11 @@
You can use either `dynaspan_text_field` or `dynaspan_text_area` in any of your views. There are two mandatory parameters. The first is a the main Object model instance you will be updating. And the other mandatory field is the symbol of the attribute to update. There are two optional fields. The first is the nested attribute object which will have its field updated. And the last is the optional text for `[edit]`-ing (clicking on to edit which is useful for blank fields).
```ruby
dynaspan_text_field(Object,OptionalNestedObject,SymField,OptionalEditText,OptionalOptionsHash)
dynaspan_text_area(Object,OptionalNestedObject,SymField,OptionalEditText,OptionalOptionsHash)
+dynaspan_select(Object,OptionalNestedObject,SymField,OptionalEditText,OptionsHash)
```
The order is important. And yes it does NOT change even if you just do:
```ruby
dynaspan_text_field(Object,SymField)
```
@@ -67,20 +68,18 @@
is a way to be able to click somewhere to open up the input to initially enter text.
The options Hash currently has these options.
- **:hidden_fields** will put in as many hidden fields as you include in a Hash with key->value matching to name->value
- - **:callback_on_update** is a no frills callback. It runs whatever command you give it whenever Dynaspan submits an update
- to the server
- - **:callback_with_values** will allow you to put a JavaScript command you want called on update and include as many parameters
- as you'd like. It will dynamically append a last parameter which is a Hash of two values. The first is the CSS selector id
- of the Dynaspan block that just performed the action, the second value is the actual text that was entered. The keys in this
- Hash are **ds_selector** and **ds_input**
- - **:unique_id** allows custom ID labelling which is ideal for JavaScript generated usage.
- - **:form_for** allows adding or over-writing any form_for parameter (besides the object being written to). This takes a Hash
- of parameters just like you would give in a view for your form_for form. If you have a namespaced object to update use
- the **url:** option in the hash for the path to use in updating your object.
+ - **:callback_on_update** is a no frills callback. It runs whatever command you give it whenever Dynaspan submits an update to the server
+ - **:callback_with_values** will allow you to put a JavaScript command you want called on update and include as many parameters as you'd like. It will dynamically append a last parameter which is a Hash of two values. The first is the CSS selector id of the Dynaspan block that just performed the action, the second value is the actual text that was entered. The keys in this Hash are **ds_selector** and **ds_input**
+ - **:unique_id** allows custom ID labelling. This is no longer recommended to be used as the in-built method is thorough in its uniqeness.
+ - **:form_for** allows adding or over-writing any form_for parameter (besides the object being written to). This takes a Hash of parameters just like you would give in a view for your form_for form. If you have a namespaced object to update use the **url:** option in the hash for the path to use in updating your object.
+ - **:html_options** add your own html options to the input field. Includes ability to add additional classes with `html_options: {class: "example"}`. **:id**, **:onfocus**, and **:onblur** are reserved.
+ - **:choices** used for **dynaspan_select** for the choices of the select box.
+ - **:options** used for **dynaspan_select** for the options of the select box; such as **:disabled**, **:prompt**, or **:include_blank**.
+ - **&block** used only with **dynaspan_select** for passing a block to Rails' form select method.
###How it updates
The AJAX call will call the update method on your first Object parameter via PATCH. The optional nested attribute
and the symbol for the field are all part of the main Object being updated. There is no expected AJAX reply. It's
@@ -117,9 +116,22 @@
margin-top:-24px;
}
```
###What's New
+
+####Version 0.1.3
+
+Changed **:unique_id** to work based on the object being rendered and some additional random characters in case the same object will be used more than once.
+
+Added **:html_options** add your own html options to the input field. Includes ability to add additional classes with `html_options: {class: "example"}`. **:id**, **:onfocus**, and **:onblur** are reserved.
+
+Added **dynaspan_select** for having a select box dynamically appear.
+ - Added **:choices** used for **dynaspan_select** for the choices of the select box.
+ - Added **:options** used for **dynaspan_select** for the options of the select box; such as **:disabled**, **:prompt**, or **:include_blank**.
+ - Added **&block** used only with **dynaspan_select** for passing a block to Rails' form select method.
+
+
####Version 0.1.2
Added **unique_id** parameter to the options Hash allowing custom ID labelling which is ideal for JavaScript generated usage.