ember-lgtm
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "ember-lgtm", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "The default blueprint for ember-cli addons.", | ||
@@ -5,0 +5,0 @@ "directories": { |
# Ember-lgtm | ||
This ember-cli addon provides a Mixin around [Square's LGTM Validation library](https://github.com/square/lgtm). The mixin follows recommended validation patterns [TODO: link to source]. This addon also adds a few LGTM helpers to add support for [nested validation](#nested-validation) and registers LGTM to use Ember's [RSVP](http://emberjs.com/api/classes/RSVP.Promise.html) | ||
This ember-cli addon provides a Mixin around [Square's LGTM Validation library](https://github.com/square/lgtm). The mixin follows recommended validation patterns [http://alistapart.com/article/inline-validation-in-web-forms]. This addon also adds a few LGTM helpers to add support for [nested validation](#nested-validation) and registers LGTM to use Ember's [RSVP](http://emberjs.com/api/classes/RSVP.Promise.html) | ||
@@ -25,8 +25,10 @@ ## Installation in your app | ||
.build(), | ||
save: function () { | ||
this.validate().then(function (isValid) { | ||
if (isValid) { | ||
// perform the actual save | ||
} | ||
}) | ||
actions: { | ||
save: function () { | ||
this.validate().then(function (isValid) { | ||
if (isValid) { | ||
// perform the actual save | ||
} | ||
}) | ||
} | ||
} | ||
@@ -41,4 +43,5 @@ // Other code... | ||
<label>Email:</label> | ||
<input type="email" class={{errors.email:error}}> | ||
{{input value=email classNames="errors.email:error"}} | ||
<span class="error">{{errors.email}}</span> | ||
<button {{action 'save'}}>Save</button> | ||
``` | ||
@@ -52,6 +55,6 @@ | ||
ember-lgtm also adds two LGTM helpers to add support for nested validations for objects and array. Here's an example of how to use them: | ||
ember-lgtm also adds two LGTM helpers to add support for nested validations for objects and arrays. Here's an example of how to use them: | ||
``` | ||
// TODO: | ||
// TODO: add example for `isValid` and `allAreValid` helpers | ||
``` | ||
@@ -58,0 +61,0 @@ |
13821
15
210
91