-
-
Save mattmcginnis/f43cad40d4ca8d95a94549840821373c to your computer and use it in GitHub Desktop.
Ember CP Validations - Disabled Bug
This file contains 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 { buildValidations, validator } from 'ember-cp-validations'; | |
const Validations = buildValidations({ | |
'something.stepOneValue': validator('presence', { | |
presence: true, | |
disabled: Ember.computed.not('model.isStepOne'), | |
message: 'stepOne value cannot be blank' | |
}), | |
'something.stepTwoValue': validator('presence', { | |
presence: true, | |
disabled: Ember.computed.not('model.isStepTwo'), | |
message: 'stepTwo value cannot be blank' | |
}), | |
'something.stepThreeValue': validator('presence', { | |
presence: true, | |
disabled: Ember.computed.not('model.isStepThree'), | |
message: 'stepThree value cannot be blank' | |
}) | |
}); | |
export default Ember.Controller.extend(Validations, { | |
appName: 'Ember Twiddle', | |
showErrors: false, | |
isStepOne: Ember.computed.equal('step', 1), | |
isStepTwo: Ember.computed.equal('step', 2), | |
isStepThree: Ember.computed.equal('step', 3), | |
actions: { | |
moveStep(direction) { | |
if (direction === 'next') { | |
this.incrementProperty('step'); | |
} else { | |
this.decrementProperty('step'); | |
} | |
} | |
} | |
}); |
This file contains 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'; | |
export default Ember.Route.extend({ | |
setupController(controller, model) { | |
controller.setProperties({ | |
model: model, | |
something: Ember.Object.create({ | |
stepOneValue: null, | |
stepTwoValue: null, | |
stepThreeValue: null | |
}), | |
step: 1 | |
}); | |
} | |
}); |
This file contains 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.15.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "2.12.2" | |
}, | |
"addons": { | |
"ember-cp-validations": "3.5.3", | |
"ember-bootstrap": "1.2.2", | |
"ember-bootstrap-cp-validations": "1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment