Skip to content
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

Finished Paper Form Component #408

Merged
merged 22 commits into from
Jul 10, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/components/paper-form-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
attributeBindings: ['style'],
style: "width:100%",
style: 'width:100%',
customValidations: [],
hasValidation: Ember.computed('min', 'max', 'errorMessages', 'maxlength', 'required', 'customValidations', function() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

destructure all the things

return this.get('min') || this.get('max') || this.get('errorMessages') || this.get('maxlength') || this.get('required') || this.get('customValidations');
Expand Down
7 changes: 6 additions & 1 deletion addon/components/paper-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default Ember.Component.extend({
tagName: '',
classNames: [],
attributeBindings: ['style'],
style: "width:100%",
style: 'width:100%',
numberOfInvalids: 0,
isValid: Ember.computed('numberOfInvalids', function() {
return this.get('numberOfInvalids') === 0 ? true : false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return condition ? true : false; is equivalent to return condition;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return condition ? true : false; is equivalent to return condition;

Expand All @@ -26,6 +26,11 @@ export default Ember.Component.extend({
}
},
submit: function() {
if (this.get('isInvalid')) {
this.set('isTouched', false);
this.set('isTouched', true);
return;
}
if (this.get('parentSubmit')) {
this.get('parentSubmit')();
}
Expand Down