-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Warning Validators #226
Conversation
Questions that need answering:
|
}).readOnly(), | ||
|
||
warning: computed('warning.[]', cycleBreaker(function () { | ||
return get(this, 'warning.0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is .0
the right thing to use here? I've always used firstObject
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same code that is the errors
and error
CPs. I believe I tried firstObject but it errored on me. Ill give it another shot though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem - definitely not required, I just haven't seen this syntax before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
firstObject ideally
* @readOnly | ||
* @type {Ember.ComputedProperty | Error} | ||
*/ | ||
warning: computed('warnings.[]', cycleBreaker(function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
firstObject
thoughts on |
* master: [Feature] Warning Validators (#226) Evaluate attrs options hash (#223) chore(package): update ember-try to version 0.2.4 (#221) Fix for data validator with format (#218) chore(package): update ember-cli to version 2.6.2 (#217) chore(package): update ember-cli-moment-shim to version 2.0.0 (#216) chore(package): update ember-cli-blanket to version 0.9.5 (#214) Add import for getOwner to README example (#215) # Conflicts: # addon/validations/result-collection.js # addon/validations/result.js # tests/integration/validations/factory-general-test.js
Use Case:
You have a password field with a length validator of
{ min: 4, max: 10 }
but want to display a warning telling the user their password is hella weak if its under 6 characters.Solution:
Warning validators!
How it works:
warnings
collection.Usage:
@rwjblue @stefanpenner @blimmer I would love to hear some input from your guys. Questions, concerns, whatever