dockyard/ember-easyForm — pull request #15 by diogomafra (2013-04-11 21:22:49+00:00)
Title: Some features

Hi Brian, I added some features that I need in this project. I don't know if you want to merge all of them, if you prefer I can submit one pull request for each feature.

# Features

## Hint
Define a hint for the input field:
```
{{input name hint='Use your first name'}}
```

## Wrappers
SimpleForm allows to customize how the input field is generated. At the moment, to have the option to at least change the class names will suffice.

With this feature it's possible to register a 'wrapper' and use it in the form:
```
Ember.EasyForm.Config.registerWrapper('twitter-bootstrap', {
formClass: 'form-horizontal',
fieldErrorClass: 'error',
errorClass: 'help-inline',
hintClass: 'help-block',
labelClass: 'control-label',
inputClass: 'control-group',
wrapControls: true,
controlsWrapperClass: 'controls',
});
```

To override the default wrapper, you just have to register a wrapper with the name 'default'.

```
Custom wrapper (uses the wrapper named 'twitter-boostrap'):
{{#formFor controller wrapper='twitter-boostrap'}}
{{/formFor}}

Default wrapper (uses the wrapper named 'default'):
{{#formFor controller}}
{{/formFor}}

```

## Wrap input in a div
Twitter Bootstrap wraps the input control in a div. Something like that:

```

```

I added the option `wrapControls` and `controlsWrapperClass` to be able to define the HTML in this format.

## Custom input types
You can register a custom input type:
```
Ember.EasyForm.Config.registerInputType('my_input', Ember.EasyForm.TextField);
```

And use it in the `as` param:
```
{{input name as=my_input}}
```

## Define options to the input field
Right now, it's not possible to customize the input field generated by the `input` helper (at least, I could not find how to do it). I added a param that passes the values directly to the input field. Similar to the "input_html" in the SimpleForm project.

```
{{input name as=text inputConfig='class:span5;rows=10'}}
```

# ...

I'm using those features in my project, they solved my problems. I don't know if you want to merge all of them (or any of them).

Please, let me know what you think of those features.

Thank you, and sorry for the giant pull request!