|
1 | | -# ember-bootstrap-cp-validations |
| 1 | +ember-bootstrap-cp-validations |
| 2 | +============================================================================== |
2 | 3 |
|
3 | 4 | [](http://badge.fury.io/js/ember-bootstrap-cp-validations) |
4 | 5 |
|
5 | | -[Ember CP Validations](https://github.com/offirgolan/ember-cp-validations) support for [Ember Bootstrap](https://github.com/kaliber5/ember-bootstrap). |
| 6 | +This Ember addon adds support for validations based on [Ember CP Validations](https://github.com/offirgolan/ember-cp-validations) to [ember-bootstrap](https://www.ember-bootstrap.com) forms. |
| 7 | +This way your forms are only submitted when the underlying data is valid, otherwise the appropriate bootstrap error |
| 8 | +markup will be applied. See the [FormElement documentation](https://www.ember-bootstrap.com/api/classes/Components.FormElement.html) for |
| 9 | +further details. |
6 | 10 |
|
7 | | -## Install |
| 11 | +Compatibility |
| 12 | +------------------------------------------------------------------------------ |
8 | 13 |
|
9 | | -```bash |
| 14 | +* Ember Bootstrap v3 |
| 15 | +* Ember CP Validations v3 |
| 16 | +* Ember.js v3.12 or above |
| 17 | +* Ember CLI v2.13 or above |
| 18 | +* Node.js v10 or above |
| 19 | + |
| 20 | + |
| 21 | +Installation |
| 22 | +------------------------------------------------------------------------------ |
| 23 | + |
| 24 | +``` |
10 | 25 | ember install ember-bootstrap-cp-validations |
11 | 26 | ``` |
12 | 27 |
|
13 | | -## Usage |
| 28 | +You should have installed the ember-bootstrap and ember-cp-validations addons already. If not install them: |
| 29 | + |
| 30 | +``` |
| 31 | +ember install ember-bootstrap |
| 32 | +ember install ember-cp-validations |
| 33 | +``` |
| 34 | + |
| 35 | +Usage |
| 36 | +------------------------------------------------------------------------------ |
| 37 | + |
| 38 | +Define your model and its validations as described in [Ember CP Validations](https://github.com/offirgolan/ember-cp-validations). |
| 39 | +Then assign the model to your form: |
| 40 | + |
| 41 | +```hbs |
| 42 | +<BsForm @model={{changeset this.user this.userValidations}} as |form|> |
| 43 | + <form.element @label="Username" @controlType="text" @property="username" /> |
| 44 | + <form.element @label="Email" @controlType="email" @property="email" /> |
| 45 | + <form.element @label="Password" @controlType="password" @property="password" /> |
| 46 | + <form.submitButton>Submit</form.submitButton> |
| 47 | +</BsForm> |
| 48 | +``` |
| 49 | + |
| 50 | +Contributing |
| 51 | +------------------------------------------------------------------------------ |
14 | 52 |
|
15 | | -Just install this addon and use ember-bootstrap as intended. This addon adds support for form validation (error and warning messages) of the following components |
| 53 | +See the [Contributing](CONTRIBUTING.md) guide for details. |
16 | 54 |
|
17 | | -- [bs-form](http://kaliber5.github.io/ember-bootstrap/api/classes/Components.Form.html) |
18 | | -- [bs-form-element](http://kaliber5.github.io/ember-bootstrap/api/classes/Components.FormElement.html) |
19 | 55 |
|
20 | | -## Requirements |
| 56 | +License |
| 57 | +------------------------------------------------------------------------------ |
21 | 58 |
|
22 | | -This addon needs ember-bootstrap starting at 1.0.0. For warning messages you will need at least ember-cp-validations 3.0. |
| 59 | +This project is licensed under the [MIT License](LICENSE.md). |
0 commit comments