Last active
May 30, 2017 07:56
-
-
Save feanor07/09bfa9316e9a4dd4841dad4f2cfd9bea to your computer and use it in GitHub Desktop.
so#44246791
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function agreeTermsValidator() { | |
return (key, newValue, oldValue, changes, content) => { | |
if (newValue === true) { | |
return true; | |
} | |
return "You need to agree on Terms!"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Component } = Ember; | |
export default Component.extend({ | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import Validation from '../validation'; | |
export default Ember.Controller.extend({ | |
Validation, | |
appName: 'Ember Twiddle', | |
form: {}, | |
actions: { | |
save(changeset) { | |
changeset.validate(); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-one-way-controls": "2.0.0", | |
"ember-changeset-validations": "1.2.6" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
validatePresence, | |
validateLength, | |
validateConfirmation, | |
validateFormat | |
} from 'ember-changeset-validations/validators'; | |
import validateAgreeTerms from './agreeTermsValidator'; | |
export default { | |
first_name: [ | |
validatePresence(true), | |
validateLength({ min: 4 }) | |
], | |
agree_terms: validateAgreeTerms(true) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment