ende 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +2 -1
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +3 -2
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +1 -2
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +37 -16
- data/lib/assets/javascripts/ende.js.coffee +1 -1
- data/lib/assets/javascripts/widgets/dialog/main.js.coffee +100 -0
- data/lib/assets/javascripts/widgets/dialog/presenter.js.coffee +18 -0
- data/lib/assets/javascripts/widgets/dialog/states/default.html +2 -0
- data/lib/assets/javascripts/widgets/dialog/states/index.js.coffee +2 -0
- data/lib/assets/javascripts/widgets/list/main.js.coffee +1 -0
- data/lib/assets/stylesheets/ende.styl +1 -0
- data/lib/ende/version.rb +1 -1
- data/lib/ende.rb +6 -2
- data/vendor/assets/components/build.css +111 -0
- data/vendor/{components/indefinido-indemma/build/release.js → assets/components/build.js} +25468 -17590
- data/vendor/assets/components/ende_build.css +111 -0
- data/vendor/assets/components/ende_build.js +29571 -0
- data/vendor/assets/javascripts/ende/build.js +1962 -0
- data/vendor/components/component-classes/component.json +19 -0
- data/vendor/components/component-classes/index.js +165 -0
- data/vendor/components/component-css/component.json +18 -0
- data/vendor/components/component-css/index.js +34 -0
- data/vendor/components/component-delegate/component.json +2 -2
- data/vendor/components/component-delegate/index.js +4 -4
- data/vendor/components/component-dialog/component.json +23 -0
- data/vendor/components/component-dialog/dialog.css +92 -0
- data/vendor/components/component-dialog/index.js +292 -0
- data/vendor/components/component-dialog/template.js +1 -0
- data/vendor/components/component-dom/component.json +33 -0
- data/vendor/components/component-dom/index.js +725 -0
- data/vendor/components/component-domify/component.json +22 -0
- data/vendor/components/component-domify/index.js +71 -0
- data/vendor/components/component-emitter/component.json +13 -0
- data/vendor/components/component-emitter/index.js +156 -0
- data/vendor/components/component-event/index.js +8 -11
- data/vendor/components/component-indexof/component.json +15 -0
- data/vendor/components/component-indexof/index.js +10 -0
- data/vendor/components/component-overlay/component.json +22 -0
- data/vendor/components/component-overlay/index.js +111 -0
- data/vendor/components/component-overlay/overlay.css +19 -0
- data/vendor/components/component-overlay/template.js +1 -0
- data/vendor/components/component-query/component.json +2 -1
- data/vendor/components/component-sort/component.json +20 -0
- data/vendor/components/component-sort/index.js +43 -0
- data/vendor/components/component-value/component.json +25 -0
- data/vendor/components/component-value/index.js +95 -0
- data/vendor/components/indefinido-indemma/component.json +2 -3
- data/vendor/components/indefinido-indemma/lib/record/resource.js +2 -4
- data/vendor/components/mikeric-rivets/component.json +1 -1
- data/vendor/components/mikeric-rivets/dist/rivets.js +64 -44
- data/vendor/components/paulmillr-es6-shim/component.json +1 -1
- data/vendor/components/paulmillr-es6-shim/es6-shim.js +22 -11
- data/vendor/components/pluma-assimilate/component.json +1 -1
- data/vendor/components/pluma-assimilate/dist/assimilate.js +103 -63
- metadata +35 -246
- data/lib/tasks/component.thor +0 -63
- data/vendor/assets/components/KapIT-observe-utils/component.json +0 -16
- data/vendor/assets/components/KapIT-observe-utils/lib/observe-utils.js +0 -780
- data/vendor/assets/components/chaijs-assertion-error/component.json +0 -18
- data/vendor/assets/components/chaijs-assertion-error/index.js +0 -110
- data/vendor/assets/components/chaijs-chai/component.json +0 -47
- data/vendor/assets/components/chaijs-chai/index.js +0 -1
- data/vendor/assets/components/chaijs-chai/lib/chai/assertion.js +0 -130
- data/vendor/assets/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/assets/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/assets/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/assets/components/chaijs-chai/lib/chai.js +0 -80
- data/vendor/assets/components/chaijs-deep-eql/component.json +0 -18
- data/vendor/assets/components/chaijs-deep-eql/lib/eql.js +0 -257
- data/vendor/assets/components/chaijs-type-detect/component.json +0 -16
- data/vendor/assets/components/chaijs-type-detect/lib/type.js +0 -142
- data/vendor/assets/components/component-bind/component.json +0 -14
- data/vendor/assets/components/component-bind/index.js +0 -24
- data/vendor/assets/components/component-delegate/component.json +0 -19
- data/vendor/assets/components/component-delegate/index.js +0 -42
- data/vendor/assets/components/component-event/component.json +0 -13
- data/vendor/assets/components/component-event/index.js +0 -40
- data/vendor/assets/components/component-jquery/component.json +0 -14
- data/vendor/assets/components/component-jquery/index.js +0 -9601
- data/vendor/assets/components/component-link-delegate/component.json +0 -23
- data/vendor/assets/components/component-link-delegate/index.js +0 -60
- data/vendor/assets/components/component-matches-selector/component.json +0 -20
- data/vendor/assets/components/component-matches-selector/index.js +0 -45
- data/vendor/assets/components/component-query/component.json +0 -21
- data/vendor/assets/components/component-query/index.js +0 -21
- data/vendor/assets/components/component-type/component.json +0 -18
- data/vendor/assets/components/component-type/index.js +0 -32
- data/vendor/assets/components/component-url/component.json +0 -17
- data/vendor/assets/components/component-url/index.js +0 -63
- data/vendor/assets/components/discore-closest/component.json +0 -14
- data/vendor/assets/components/discore-closest/index.js +0 -18
- data/vendor/assets/components/indefinido-advisable/component.json +0 -21
- data/vendor/assets/components/indefinido-advisable/index.js +0 -1
- data/vendor/assets/components/indefinido-advisable/lib/advisable.js +0 -60
- data/vendor/assets/components/indefinido-indemma/component.json +0 -40
- data/vendor/assets/components/indefinido-indemma/index.js +0 -1
- data/vendor/assets/components/indefinido-indemma/lib/extensions/rivets.js +0 -23
- data/vendor/assets/components/indefinido-indemma/lib/record/associable.js +0 -217
- data/vendor/assets/components/indefinido-indemma/lib/record/maid.js +0 -24
- data/vendor/assets/components/indefinido-indemma/lib/record/resource.js +0 -104
- data/vendor/assets/components/indefinido-indemma/lib/record/rest.js +0 -36
- data/vendor/assets/components/indefinido-indemma/lib/record/restfulable.js +0 -326
- data/vendor/assets/components/indefinido-indemma/lib/record/scopable.js +0 -279
- data/vendor/assets/components/indefinido-indemma/lib/record/translationable.js +0 -19
- data/vendor/assets/components/indefinido-indemma/lib/record/validatable.js +0 -216
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/associated.js +0 -30
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/confirmation.js +0 -19
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/cpf.js +0 -60
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/presence.js +0 -19
- data/vendor/assets/components/indefinido-indemma/lib/record/validations/remote.js +0 -71
- data/vendor/assets/components/indefinido-indemma/lib/record.js +0 -167
- data/vendor/assets/components/indefinido-indemma/vendor/sinon.js +0 -4290
- data/vendor/assets/components/indefinido-indemma/vendor/stampit.js +0 -392
- data/vendor/assets/components/indefinido-observable/component.json +0 -25
- data/vendor/assets/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
- data/vendor/assets/components/indefinido-observable/index.js +0 -1
- data/vendor/assets/components/indefinido-observable/lib/adapters/rivets.js +0 -26
- data/vendor/assets/components/indefinido-observable/lib/observable.js +0 -320
- data/vendor/assets/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
- data/vendor/assets/components/indefinido-observable/vendor/shims/accessors.js +0 -173
- data/vendor/assets/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
- data/vendor/assets/components/indefinido-observable/vendor/shims/object.create.js +0 -77
- data/vendor/assets/components/mikeric-rivets/component.json +0 -15
- data/vendor/assets/components/mikeric-rivets/dist/rivets.js +0 -1020
- data/vendor/assets/components/paulmillr-es6-shim/component.json +0 -17
- data/vendor/assets/components/paulmillr-es6-shim/es6-shim.js +0 -985
- data/vendor/assets/components/pluma-assimilate/component.json +0 -25
- data/vendor/assets/components/pluma-assimilate/dist/assimilate.js +0 -87
- data/vendor/assets/components/segmentio-extend/component.json +0 -13
- data/vendor/assets/components/segmentio-extend/index.js +0 -15
- data/vendor/components/chaijs-assertion-error/component.json +0 -18
- data/vendor/components/chaijs-assertion-error/index.js +0 -110
- data/vendor/components/chaijs-chai/component.json +0 -47
- data/vendor/components/chaijs-chai/index.js +0 -1
- data/vendor/components/chaijs-chai/lib/chai/assertion.js +0 -130
- data/vendor/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
- data/vendor/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
- data/vendor/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/components/chaijs-chai/lib/chai.js +0 -80
- data/vendor/components/chaijs-deep-eql/component.json +0 -18
- data/vendor/components/chaijs-deep-eql/lib/eql.js +0 -257
- data/vendor/components/chaijs-type-detect/component.json +0 -16
- data/vendor/components/chaijs-type-detect/lib/type.js +0 -142
- data/vendor/components/component-link-delegate/component.json +0 -23
- data/vendor/components/component-link-delegate/index.js +0 -60
- data/vendor/components/component-url/component.json +0 -17
- data/vendor/components/component-url/index.js +0 -63
- data/vendor/components/discore-closest/component.json +0 -14
- data/vendor/components/discore-closest/index.js +0 -18
- data/vendor/components/indefinido-indemma/.gitignore +0 -14
- data/vendor/components/indefinido-indemma/.ruby-gemset +0 -1
- data/vendor/components/indefinido-indemma/.ruby-version +0 -1
- data/vendor/components/indefinido-indemma/Gemfile +0 -13
- data/vendor/components/indefinido-indemma/Guardfile +0 -39
- data/vendor/components/indefinido-indemma/History.md +0 -0
- data/vendor/components/indefinido-indemma/Readme.md +0 -443
- data/vendor/components/indefinido-indemma/build/development.js +0 -331
- data/vendor/components/indefinido-indemma/build/test.js +0 -331
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/component.json +0 -18
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/index.js +0 -110
- data/vendor/components/indefinido-indemma/components/chaijs-chai/component.json +0 -47
- data/vendor/components/indefinido-indemma/components/chaijs-chai/index.js +0 -1
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/assertion.js +0 -130
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/eql.js +0 -129
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai.js +0 -80
- data/vendor/components/indefinido-indemma/components/component-bind/component.json +0 -14
- data/vendor/components/indefinido-indemma/components/component-bind/index.js +0 -24
- data/vendor/components/indefinido-indemma/components/component-jquery/component.json +0 -14
- data/vendor/components/indefinido-indemma/components/component-jquery/index.js +0 -9601
- data/vendor/components/indefinido-indemma/components/component-type/component.json +0 -18
- data/vendor/components/indefinido-indemma/components/component-type/index.js +0 -32
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/component.json +0 -21
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/index.js +0 -1
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/lib/advisable.js +0 -60
- data/vendor/components/indefinido-indemma/components/indefinido-observable/component.json +0 -25
- data/vendor/components/indefinido-indemma/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
- data/vendor/components/indefinido-indemma/components/indefinido-observable/index.js +0 -1
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/adapters/rivets.js +0 -26
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/observable.js +0 -323
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors.js +0 -173
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/object.create.js +0 -77
- data/vendor/components/indefinido-indemma/components/kapit-observe-utils/component.json +0 -13
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/component.json +0 -25
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/dist/assimilate.js +0 -87
- data/vendor/components/indefinido-indemma/karma.conf.js +0 -86
- data/vendor/components/indefinido-indemma/lib/record/errors.js +0 -1
- data/vendor/components/indefinido-indemma/spec/record/associable_spec.js +0 -76
- data/vendor/components/indefinido-indemma/spec/record/resource_spec.js +0 -90
- data/vendor/components/indefinido-indemma/spec/record/rest_spec.js +0 -32
- data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +0 -232
- data/vendor/components/indefinido-indemma/spec/record/scopable_spec.js +0 -201
- data/vendor/components/indefinido-indemma/spec/record/translationable.js +0 -28
- data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +0 -111
- data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +0 -43
- data/vendor/components/indefinido-indemma/spec/record/validations/confirmation_spec.js +0 -36
- data/vendor/components/indefinido-indemma/spec/record/validations/cpf_spec.js +0 -35
- data/vendor/components/indefinido-indemma/spec/record/validations/presence_spec.js +0 -28
- data/vendor/components/indefinido-indemma/spec/record/validations/remote_spec.js +0 -86
- data/vendor/components/indefinido-indemma/spec/record/validations/type_spec.js +0 -48
- data/vendor/components/indefinido-indemma/spec/record_spec.js +0 -37
- data/vendor/components/indefinido-indemma/spec/spec_helper.js +0 -11
- data/vendor/components/indefinido-indemma/spec/support/value_objects/phone.js +0 -45
- data/vendor/components/indefinido-indemma/src/lib/extensions/rivets.coffee +0 -17
- data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +0 -173
- data/vendor/components/indefinido-indemma/src/lib/record/errors.coffee +0 -20
- data/vendor/components/indefinido-indemma/src/lib/record/maid.coffee +0 -16
- data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +0 -103
- data/vendor/components/indefinido-indemma/src/lib/record/rest.coffee +0 -28
- data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +0 -314
- data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +0 -266
- data/vendor/components/indefinido-indemma/src/lib/record/translationable.coffee +0 -18
- data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +0 -209
- data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +0 -32
- data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +0 -19
- data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +0 -58
- data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +0 -19
- data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +0 -65
- data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +0 -32
- data/vendor/components/indefinido-indemma/src/lib/record.coffee +0 -123
- data/vendor/components/indefinido-indemma/src/spec/record/associable_spec.coffee +0 -63
- data/vendor/components/indefinido-indemma/src/spec/record/resource_spec.coffee +0 -64
- data/vendor/components/indefinido-indemma/src/spec/record/rest_spec.coffee +0 -22
- data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +0 -164
- data/vendor/components/indefinido-indemma/src/spec/record/scopable_spec.coffee +0 -181
- data/vendor/components/indefinido-indemma/src/spec/record/translationable.coffee +0 -19
- data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +0 -100
- data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +0 -35
- data/vendor/components/indefinido-indemma/src/spec/record/validations/confirmation_spec.coffee +0 -25
- data/vendor/components/indefinido-indemma/src/spec/record/validations/cpf_spec.coffee +0 -28
- data/vendor/components/indefinido-indemma/src/spec/record/validations/presence_spec.coffee +0 -24
- data/vendor/components/indefinido-indemma/src/spec/record/validations/remote_spec.coffee +0 -72
- data/vendor/components/indefinido-indemma/src/spec/record/validations/type_spec.coffee +0 -33
- data/vendor/components/indefinido-indemma/src/spec/record_spec.coffee +0 -23
- data/vendor/components/indefinido-indemma/src/spec/spec_helper.coffee +0 -9
- data/vendor/components/indefinido-indemma/src/spec/support/value_objects/phone.coffee +0 -30
- data/vendor/components/indefinido-indemma/vendor/owl/pluralize.js +0 -190
@@ -1,279 +0,0 @@
|
|
1
|
-
var $, builders, defaults, extend, merge, model, record, rest, scopable, stampit,
|
2
|
-
__slice = [].slice;
|
3
|
-
|
4
|
-
require('./restfulable');
|
5
|
-
|
6
|
-
require('./resource');
|
7
|
-
|
8
|
-
stampit = require('../../vendor/stampit');
|
9
|
-
|
10
|
-
extend = require('assimilate');
|
11
|
-
|
12
|
-
merge = extend.withStrategy('deep');
|
13
|
-
|
14
|
-
$ = require('jquery');
|
15
|
-
|
16
|
-
rest = require('./rest');
|
17
|
-
|
18
|
-
scopable = {
|
19
|
-
builder: stampit().enclose(function() {
|
20
|
-
return stampit.mixIn(function(name, type) {
|
21
|
-
var builder;
|
22
|
-
|
23
|
-
if ($.type(type) === 'function') {
|
24
|
-
this["$" + name] = type() || new type;
|
25
|
-
type = $.type(this["$" + name]);
|
26
|
-
} else {
|
27
|
-
this["$" + name] = defaults[type] || type;
|
28
|
-
}
|
29
|
-
if ($.type(type) !== 'string') {
|
30
|
-
type = $.type(type);
|
31
|
-
}
|
32
|
-
builder = builders[type];
|
33
|
-
if (builder == null) {
|
34
|
-
throw "Unknown scope type " + type + " for model with resource " + model.resource;
|
35
|
-
}
|
36
|
-
this.scope.declared.push(name);
|
37
|
-
return this[name] = builder({
|
38
|
-
name: name
|
39
|
-
});
|
40
|
-
}, {
|
41
|
-
data: {},
|
42
|
-
then: [],
|
43
|
-
fail: [],
|
44
|
-
declared: [],
|
45
|
-
fetch: function(data, done, fail) {
|
46
|
-
var promise, scope;
|
47
|
-
|
48
|
-
scope = extend({}, this.scope.data);
|
49
|
-
promise = rest.get.call(this, extend(scope, data)).done(this.scope.then.concat(done)).fail([this.scope.fail, fail]);
|
50
|
-
this.scope.clear();
|
51
|
-
return promise;
|
52
|
-
},
|
53
|
-
clear: function() {
|
54
|
-
this.data = {};
|
55
|
-
return this.callbacks = [];
|
56
|
-
}
|
57
|
-
});
|
58
|
-
}),
|
59
|
-
base: stampit().state({
|
60
|
-
name: 'unamed_scope'
|
61
|
-
}),
|
62
|
-
record: {
|
63
|
-
failed: function(xhr, error, status) {
|
64
|
-
var e, message, payload;
|
65
|
-
|
66
|
-
payload = xhr.responseJSON;
|
67
|
-
try {
|
68
|
-
payload || (payload = JSON.parse(xhr.responseText));
|
69
|
-
} catch (_error) {
|
70
|
-
e = _error;
|
71
|
-
}
|
72
|
-
payload || (payload = xhr.responseText);
|
73
|
-
switch (xhr.status) {
|
74
|
-
case 422:
|
75
|
-
this.valid = false;
|
76
|
-
return this.errors = payload.errors;
|
77
|
-
default:
|
78
|
-
message = "Fail in " + this.resource + ".save:\n";
|
79
|
-
message += "Record: " + this + "\n";
|
80
|
-
message += "Status: " + status + " (" + (payload.status || xhr.status) + ")\n";
|
81
|
-
message += "Error : " + (payload.error || payload.message || payload);
|
82
|
-
}
|
83
|
-
return console.error(message);
|
84
|
-
}
|
85
|
-
},
|
86
|
-
model: {
|
87
|
-
fetch: function(data, done, fail) {
|
88
|
-
return this.scope.fetch.call(this, data, done, fail);
|
89
|
-
},
|
90
|
-
forward_scopes_to_associations: function() {
|
91
|
-
var associated_factory, associated_resource, association, association_name, factory, forwarder, generate_forwarder, scope, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
|
92
|
-
|
93
|
-
factory = model[this.resource];
|
94
|
-
_ref = factory.has_many;
|
95
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
96
|
-
association_name = _ref[_i];
|
97
|
-
associated_resource = model.singularize(association_name);
|
98
|
-
associated_factory = model[associated_resource];
|
99
|
-
if (!model[associated_resource]) {
|
100
|
-
console.warn("Associated factory not found for associated resource: " + associated_resource);
|
101
|
-
continue;
|
102
|
-
}
|
103
|
-
association = this[association_name];
|
104
|
-
association.scope = scopable.builder(association);
|
105
|
-
_ref1 = associated_factory.scope.declared;
|
106
|
-
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
107
|
-
scope = _ref1[_j];
|
108
|
-
association.scope(scope, associated_factory["$" + scope]);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
_ref2 = factory.has_one;
|
112
|
-
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
113
|
-
associated_resource = _ref2[_k];
|
114
|
-
if (!model[associated_resource]) {
|
115
|
-
console.warn("Associated factory not found for associated resource: " + associated_resource);
|
116
|
-
continue;
|
117
|
-
}
|
118
|
-
_ref3 = model[associated_resource].scope.declared;
|
119
|
-
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
|
120
|
-
scope = _ref3[_l];
|
121
|
-
this[associated_resource][scope] = factory[scope];
|
122
|
-
}
|
123
|
-
}
|
124
|
-
if (factory.belongs_to.length) {
|
125
|
-
generate_forwarder = function(associated_resource) {
|
126
|
-
var declared_scopes;
|
127
|
-
|
128
|
-
associated_factory = model[associated_resource];
|
129
|
-
if (!associated_factory) {
|
130
|
-
return console.warn("Associated factory not found for associated resource: " + associated_resource);
|
131
|
-
}
|
132
|
-
declared_scopes = associated_factory.scope.declared;
|
133
|
-
return function() {
|
134
|
-
var _len4, _m, _results;
|
135
|
-
|
136
|
-
_results = [];
|
137
|
-
for (_m = 0, _len4 = declared_scopes.length; _m < _len4; _m++) {
|
138
|
-
scope = declared_scopes[_m];
|
139
|
-
_results.push(this[associated_resource][scope] = associated_factory[scope]);
|
140
|
-
}
|
141
|
-
return _results;
|
142
|
-
};
|
143
|
-
};
|
144
|
-
_ref4 = factory.belongs_to;
|
145
|
-
for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
|
146
|
-
associated_resource = _ref4[_m];
|
147
|
-
forwarder = generate_forwarder(associated_resource);
|
148
|
-
this.after("build_" + associated_resource, forwarder);
|
149
|
-
}
|
150
|
-
}
|
151
|
-
return true;
|
152
|
-
}
|
153
|
-
},
|
154
|
-
after_mix: function() {
|
155
|
-
var name, property, type, _results;
|
156
|
-
|
157
|
-
this.scope = scopable.builder(this);
|
158
|
-
_results = [];
|
159
|
-
for (property in this) {
|
160
|
-
type = this[property];
|
161
|
-
if (property.charAt(0) === '$') {
|
162
|
-
name = property.substring(1);
|
163
|
-
_results.push(this.scope(name, type));
|
164
|
-
} else {
|
165
|
-
_results.push(void 0);
|
166
|
-
}
|
167
|
-
}
|
168
|
-
return _results;
|
169
|
-
}
|
170
|
-
};
|
171
|
-
|
172
|
-
builders = {
|
173
|
-
boolean: stampit().enclose(function() {
|
174
|
-
var base;
|
175
|
-
|
176
|
-
base = scopable.base(this);
|
177
|
-
return stampit.mixIn(function() {
|
178
|
-
var callbacks, value, _base, _name;
|
179
|
-
|
180
|
-
value = arguments[0], callbacks = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
181
|
-
callbacks.length && (this.scope.then = this.scope.then.concat(callbacks));
|
182
|
-
(_base = this.scope.data)[_name = base.name] || (_base[_name] = value != null ? value : this["$" + base.name]);
|
183
|
-
return this;
|
184
|
-
});
|
185
|
-
}),
|
186
|
-
array: stampit().enclose(function() {
|
187
|
-
var base;
|
188
|
-
|
189
|
-
base = scopable.base(this);
|
190
|
-
return stampit.mixIn(function() {
|
191
|
-
var values, _base, _name;
|
192
|
-
|
193
|
-
values = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
194
|
-
(_base = this.scope.data)[_name = base.name] || (_base[_name] = values != null ? values : this["$" + base.name]);
|
195
|
-
return this;
|
196
|
-
});
|
197
|
-
})
|
198
|
-
};
|
199
|
-
|
200
|
-
defaults = {
|
201
|
-
boolean: true,
|
202
|
-
array: []
|
203
|
-
};
|
204
|
-
|
205
|
-
model = window.model;
|
206
|
-
|
207
|
-
record = window.record;
|
208
|
-
|
209
|
-
model.scopable = true;
|
210
|
-
|
211
|
-
model.mix(function(modelable) {
|
212
|
-
merge(modelable, scopable.model);
|
213
|
-
return modelable.after_mix.push(scopable.after_mix);
|
214
|
-
});
|
215
|
-
|
216
|
-
if (model.associable) {
|
217
|
-
model.mix(function(modelable) {
|
218
|
-
return modelable.record.after_initialize.push(function() {
|
219
|
-
return scopable.model.forward_scopes_to_associations.call(this);
|
220
|
-
});
|
221
|
-
});
|
222
|
-
model.associable.mix(function(singular_association, plural_association) {
|
223
|
-
plural_association.all = plural_association.reload = function(data, done, fail) {
|
224
|
-
var promises, reload;
|
225
|
-
|
226
|
-
if (this.parent != null) {
|
227
|
-
this.route || (this.route = "" + this.parent.route + "/" + this.parent._id + "/" + (model.pluralize(this.resource)));
|
228
|
-
}
|
229
|
-
promises = [];
|
230
|
-
if (typeof data === 'function') {
|
231
|
-
done = data;
|
232
|
-
data = void 0;
|
233
|
-
}
|
234
|
-
promises.push(this.scope.fetch.call(this, data, null, scopable.record.failed));
|
235
|
-
reload = $.when.apply(jQuery, promises);
|
236
|
-
reload.done(function(records, status) {
|
237
|
-
var association_name, singular_resource, _i, _j, _len, _len1, _ref;
|
238
|
-
|
239
|
-
Array.prototype.splice.call(this, 0);
|
240
|
-
if (!records.length) {
|
241
|
-
return;
|
242
|
-
}
|
243
|
-
singular_resource = model.singularize(this.resource);
|
244
|
-
for (_i = 0, _len = records.length; _i < _len; _i++) {
|
245
|
-
record = records[_i];
|
246
|
-
_ref = model[singular_resource].has_many;
|
247
|
-
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
248
|
-
association_name = _ref[_j];
|
249
|
-
record["" + association_name + "_attributes"] = record[association_name];
|
250
|
-
delete record[association_name];
|
251
|
-
}
|
252
|
-
}
|
253
|
-
this.add.apply(this, records);
|
254
|
-
records.splice(0);
|
255
|
-
return records.push.apply(records, this);
|
256
|
-
});
|
257
|
-
reload.done(done);
|
258
|
-
reload.fail(fail);
|
259
|
-
return reload;
|
260
|
-
};
|
261
|
-
return plural_association.each = function(callback) {
|
262
|
-
var _this = this;
|
263
|
-
|
264
|
-
if (this.parent != null) {
|
265
|
-
this.route || (this.route = "" + this.parent.route + "/" + this.parent._id + "/" + (model.pluralize(this.resource)));
|
266
|
-
}
|
267
|
-
return this.get().done(function(records) {
|
268
|
-
var _i, _len, _results;
|
269
|
-
|
270
|
-
_results = [];
|
271
|
-
for (_i = 0, _len = _this.length; _i < _len; _i++) {
|
272
|
-
record = _this[_i];
|
273
|
-
_results.push(callback(record));
|
274
|
-
}
|
275
|
-
return _results;
|
276
|
-
});
|
277
|
-
};
|
278
|
-
});
|
279
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
var extend, extensions, root;
|
2
|
-
|
3
|
-
root = typeof exports !== "undefined" && exports !== null ? exports : window;
|
4
|
-
|
5
|
-
extend = require('assimilate');
|
6
|
-
|
7
|
-
extensions = {
|
8
|
-
model: {
|
9
|
-
human_attribute_name: function(attribute_name) {
|
10
|
-
var _ref, _ref1;
|
11
|
-
|
12
|
-
return ((_ref = this.translation) != null ? (_ref1 = _ref.attributes) != null ? _ref1[attribute_name] : void 0 : void 0) || attribute_name;
|
13
|
-
}
|
14
|
-
}
|
15
|
-
};
|
16
|
-
|
17
|
-
model.mix(function(modelable) {
|
18
|
-
return extend(modelable, extensions.model);
|
19
|
-
});
|
@@ -1,216 +0,0 @@
|
|
1
|
-
var errorsable, extensions, initializers, manager, messages, observable, root, stampit, type, validatable;
|
2
|
-
|
3
|
-
require('./translationable');
|
4
|
-
|
5
|
-
root = typeof exports !== "undefined" && exports !== null ? exports : window;
|
6
|
-
|
7
|
-
stampit = require('../../vendor/stampit');
|
8
|
-
|
9
|
-
observable = require('observable').mixin;
|
10
|
-
|
11
|
-
type = require('type');
|
12
|
-
|
13
|
-
messages = {
|
14
|
-
blank: function(attribute_name) {
|
15
|
-
attribute_name = this.human_attribute_name(attribute_name);
|
16
|
-
return "O campo " + attribute_name + " não pode ficar em branco.";
|
17
|
-
},
|
18
|
-
cpf: function(attribute_name) {
|
19
|
-
attribute_name = this.human_attribute_name(attribute_name);
|
20
|
-
return "O campo " + attribute_name + " não está válido.";
|
21
|
-
},
|
22
|
-
confirmation: function(attribute_name) {
|
23
|
-
var confirmation_attribute_name;
|
24
|
-
|
25
|
-
confirmation_attribute_name = this.human_attribute_name("" + attribute_name + "_confirmation");
|
26
|
-
attribute_name = this.human_attribute_name(attribute_name);
|
27
|
-
return "O campo " + attribute_name + " não está diacordo com a confirmação " + confirmation_attribute_name + ".";
|
28
|
-
},
|
29
|
-
associated: function(attribute_name) {
|
30
|
-
attribute_name = this.human_attribute_name(attribute_name);
|
31
|
-
return "O registro associado " + attribute_name + " não é válido";
|
32
|
-
},
|
33
|
-
server: function(attribute_name, options) {
|
34
|
-
return "" + (this.human_attribute_name(attribute_name)) + " " + options.server_message + " ";
|
35
|
-
}
|
36
|
-
};
|
37
|
-
|
38
|
-
errorsable = stampit({
|
39
|
-
add: function(attribute_name, message_key, options) {
|
40
|
-
var translator;
|
41
|
-
|
42
|
-
this.push([attribute_name, message_key, options]);
|
43
|
-
this.messages[attribute_name] = '';
|
44
|
-
translator = messages[message_key];
|
45
|
-
if (translator != null) {
|
46
|
-
return this.messages[attribute_name] += translator.call(this.model, attribute_name, options);
|
47
|
-
} else {
|
48
|
-
return this.messages[attribute_name] += message_key;
|
49
|
-
}
|
50
|
-
},
|
51
|
-
clear: function() {
|
52
|
-
var attribute_name, _results;
|
53
|
-
|
54
|
-
if (this.length) {
|
55
|
-
this.length = 0;
|
56
|
-
_results = [];
|
57
|
-
for (attribute_name in this.messages) {
|
58
|
-
_results.push(this.messages[attribute_name] = null);
|
59
|
-
}
|
60
|
-
return _results;
|
61
|
-
}
|
62
|
-
},
|
63
|
-
push: Array.prototype.push,
|
64
|
-
splice: Array.prototype.splice
|
65
|
-
}, {
|
66
|
-
model: null,
|
67
|
-
messages: {},
|
68
|
-
length: 0
|
69
|
-
});
|
70
|
-
|
71
|
-
initializers = {
|
72
|
-
define_triggers: function() {
|
73
|
-
this.errors = errorsable({
|
74
|
-
model: model[this.resource]
|
75
|
-
});
|
76
|
-
this.before('save', function() {
|
77
|
-
if (this.save) {
|
78
|
-
return this.validate();
|
79
|
-
}
|
80
|
-
});
|
81
|
-
this.validated = false;
|
82
|
-
this.subscribe('dirty', function() {
|
83
|
-
return this.validated = false;
|
84
|
-
});
|
85
|
-
return Object.defineProperty(this, 'valid', {
|
86
|
-
get: function() {
|
87
|
-
this.validate();
|
88
|
-
if (this.validation.state() === 'resolved') {
|
89
|
-
return !this.errors.length;
|
90
|
-
} else {
|
91
|
-
return null;
|
92
|
-
}
|
93
|
-
},
|
94
|
-
set: function() {
|
95
|
-
throw new TypeError("You can't set the value for the valid property.");
|
96
|
-
},
|
97
|
-
enumerable: false
|
98
|
-
});
|
99
|
-
},
|
100
|
-
create_validators: function(definitions) {
|
101
|
-
var definition, name, validator, validator_options, _ref, _results;
|
102
|
-
|
103
|
-
_ref = manager.validators;
|
104
|
-
_results = [];
|
105
|
-
for (name in _ref) {
|
106
|
-
validator = _ref[name];
|
107
|
-
definition = definitions[validator.definition_key];
|
108
|
-
if (definition) {
|
109
|
-
if (type(definition) !== 'array') {
|
110
|
-
definition = [definition];
|
111
|
-
}
|
112
|
-
_results.push((function() {
|
113
|
-
var _i, _len, _results1;
|
114
|
-
|
115
|
-
_results1 = [];
|
116
|
-
for (_i = 0, _len = definition.length; _i < _len; _i++) {
|
117
|
-
validator_options = definition[_i];
|
118
|
-
if (type(validator_options) !== 'object') {
|
119
|
-
validator_options = {
|
120
|
-
attribute_name: validator_options
|
121
|
-
};
|
122
|
-
}
|
123
|
-
validator_options.model = this;
|
124
|
-
this.validators.push(validator(validator_options));
|
125
|
-
_results1.push(delete definitions[validator.definition_key]);
|
126
|
-
}
|
127
|
-
return _results1;
|
128
|
-
}).call(this));
|
129
|
-
} else {
|
130
|
-
_results.push(void 0);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
return _results;
|
134
|
-
}
|
135
|
-
};
|
136
|
-
|
137
|
-
extensions = {
|
138
|
-
model: {
|
139
|
-
validators: []
|
140
|
-
},
|
141
|
-
record: {
|
142
|
-
validate_attribute: function(attribute, doned, failed) {
|
143
|
-
var results, validation, validator, _i, _len, _ref;
|
144
|
-
|
145
|
-
this.errors.messages[attribute] = null;
|
146
|
-
results = [this, attribute];
|
147
|
-
_ref = model[this.resource].validators;
|
148
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
149
|
-
validator = _ref[_i];
|
150
|
-
if (validator.attribute_name === attribute) {
|
151
|
-
results.push(validator.validate_each(this, validator.attribute_name, this[validator.attribute_name]));
|
152
|
-
}
|
153
|
-
}
|
154
|
-
validation = jQuery.when.apply(jQuery, results);
|
155
|
-
validation.done(doned);
|
156
|
-
validation.fail(failed);
|
157
|
-
return validation;
|
158
|
-
},
|
159
|
-
validate: function(doned, failed) {
|
160
|
-
var results, validator, _i, _len, _ref;
|
161
|
-
|
162
|
-
if (this.validated) {
|
163
|
-
return this.validation;
|
164
|
-
}
|
165
|
-
this.errors.clear();
|
166
|
-
results = [this];
|
167
|
-
_ref = model[this.resource].validators;
|
168
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
169
|
-
validator = _ref[_i];
|
170
|
-
results.push(validator.validate_each(this, validator.attribute_name, this[validator.attribute_name]));
|
171
|
-
}
|
172
|
-
this.validation = jQuery.when.apply(jQuery, results);
|
173
|
-
this.validation.done(doned);
|
174
|
-
this.validation.fail(failed);
|
175
|
-
this.validation.then(function(record) {
|
176
|
-
return record.validated = true;
|
177
|
-
});
|
178
|
-
return this.validation;
|
179
|
-
}
|
180
|
-
}
|
181
|
-
};
|
182
|
-
|
183
|
-
manager = {
|
184
|
-
validators: {}
|
185
|
-
};
|
186
|
-
|
187
|
-
validatable = stampit({
|
188
|
-
validate: function() {
|
189
|
-
throw new Error('Composed factory must override the validate method');
|
190
|
-
},
|
191
|
-
validate_each: function() {
|
192
|
-
throw new Error('Composed factory must override the validate each method');
|
193
|
-
}
|
194
|
-
});
|
195
|
-
|
196
|
-
model.mix(function(modelable) {
|
197
|
-
jQuery.extend(modelable, extensions.model);
|
198
|
-
jQuery.extend(modelable.record, extensions.record);
|
199
|
-
modelable.after_mix.unshift(initializers.create_validators);
|
200
|
-
modelable.record.after_initialize.push(initializers.define_triggers);
|
201
|
-
return model.validators = manager.validators;
|
202
|
-
});
|
203
|
-
|
204
|
-
root.validatable = validatable;
|
205
|
-
|
206
|
-
root.manager = manager;
|
207
|
-
|
208
|
-
require('./validations/confirmation');
|
209
|
-
|
210
|
-
require('./validations/associated');
|
211
|
-
|
212
|
-
require('./validations/presence');
|
213
|
-
|
214
|
-
require('./validations/remote');
|
215
|
-
|
216
|
-
require('./validations/cpf');
|
@@ -1,30 +0,0 @@
|
|
1
|
-
var associationable, composed, stampit, validations;
|
2
|
-
|
3
|
-
validations = require('../validatable');
|
4
|
-
|
5
|
-
stampit = require('../../../vendor/stampit');
|
6
|
-
|
7
|
-
associationable = stampit({
|
8
|
-
validate_each: function(record, attribute, value) {
|
9
|
-
var associated_validation;
|
10
|
-
|
11
|
-
if (record[attribute]) {
|
12
|
-
if (model[record.resource].has_one.indexOf(attribute) === -1) {
|
13
|
-
throw new Error('Only has_one associations are supported to validates_associated');
|
14
|
-
}
|
15
|
-
associated_validation = record[attribute].validate();
|
16
|
-
associated_validation.done(function() {
|
17
|
-
if (record[attribute].errors.length) {
|
18
|
-
return record.errors.add(attribute, 'associated', this.options);
|
19
|
-
}
|
20
|
-
});
|
21
|
-
return associated_validation;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
composed = stampit.compose(validations.validatable, associationable);
|
27
|
-
|
28
|
-
composed.definition_key = 'validates_associated';
|
29
|
-
|
30
|
-
validations.manager.validators.association = composed;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
var composed, confirmationable, stampit, validations;
|
2
|
-
|
3
|
-
validations = require('../validatable');
|
4
|
-
|
5
|
-
stampit = require('../../../vendor/stampit');
|
6
|
-
|
7
|
-
confirmationable = stampit({
|
8
|
-
validate_each: function(record, attribute, value) {
|
9
|
-
if (record[attribute] !== record["" + attribute + "_confirmation"]) {
|
10
|
-
return record.errors.add(attribute, 'confirmation', this.options);
|
11
|
-
}
|
12
|
-
}
|
13
|
-
});
|
14
|
-
|
15
|
-
composed = stampit.compose(validations.validatable, confirmationable);
|
16
|
-
|
17
|
-
composed.definition_key = 'validates_confirmation_of';
|
18
|
-
|
19
|
-
validations.manager.validators.confirmation = composed;
|
@@ -1,60 +0,0 @@
|
|
1
|
-
var composed, cpfable, stampit, validations;
|
2
|
-
|
3
|
-
validations = require('../validatable');
|
4
|
-
|
5
|
-
stampit = require('../../../vendor/stampit');
|
6
|
-
|
7
|
-
cpfable = stampit({
|
8
|
-
validate_format: function(value) {
|
9
|
-
var c, d1, dv, i, v, _i, _j;
|
10
|
-
|
11
|
-
value = value.replace(/[\.\-]/g, "");
|
12
|
-
if (value.length < 11) {
|
13
|
-
return false;
|
14
|
-
}
|
15
|
-
if (value.match(/^(0+|1+|2+|3+|4+|5+|6+|7+|8+|9+)$/)) {
|
16
|
-
return false;
|
17
|
-
}
|
18
|
-
c = value.substr(0, 9);
|
19
|
-
dv = value.substr(9, 2);
|
20
|
-
d1 = 0;
|
21
|
-
v = false;
|
22
|
-
i = 0;
|
23
|
-
for (i = _i = 1; _i <= 9; i = ++_i) {
|
24
|
-
d1 += c.charAt(i) * (10 - i);
|
25
|
-
}
|
26
|
-
if (d1 === 0) {
|
27
|
-
return false;
|
28
|
-
}
|
29
|
-
d1 = 11 - (d1 % 11);
|
30
|
-
if (d1 > 9) {
|
31
|
-
d1 = 0;
|
32
|
-
}
|
33
|
-
if (+dv.charAt(0 !== d1)) {
|
34
|
-
return false;
|
35
|
-
}
|
36
|
-
d1 *= 2;
|
37
|
-
for (i = _j = 1; _j <= 9; i = ++_j) {
|
38
|
-
d1 += c.charAt(i) * (11 - i);
|
39
|
-
}
|
40
|
-
d1 = 11 - (d1 % 11);
|
41
|
-
if (d1 > 9) {
|
42
|
-
d1 = 0;
|
43
|
-
}
|
44
|
-
if (+dv.charAt(1) !== d1) {
|
45
|
-
return false;
|
46
|
-
}
|
47
|
-
return true;
|
48
|
-
},
|
49
|
-
validate_each: function(record, attribute, value) {
|
50
|
-
if (value && !this.validate_format(value)) {
|
51
|
-
return record.errors.add(attribute, 'cpf', this.options);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
});
|
55
|
-
|
56
|
-
composed = stampit.compose(validations.validatable, cpfable);
|
57
|
-
|
58
|
-
composed.definition_key = 'validates_cpf_format';
|
59
|
-
|
60
|
-
validations.manager.validators.cpf = composed;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
var composed, presenceable, stampit, validations;
|
2
|
-
|
3
|
-
validations = require('../validatable');
|
4
|
-
|
5
|
-
stampit = require('../../../vendor/stampit');
|
6
|
-
|
7
|
-
presenceable = stampit({
|
8
|
-
validate_each: function(record, attribute, value) {
|
9
|
-
if (value === null || value === '' || value === void 0) {
|
10
|
-
return record.errors.add(attribute, 'blank', this.options);
|
11
|
-
}
|
12
|
-
}
|
13
|
-
});
|
14
|
-
|
15
|
-
composed = stampit.compose(validations.validatable, presenceable);
|
16
|
-
|
17
|
-
composed.definition_key = 'validates_presence_of';
|
18
|
-
|
19
|
-
validations.manager.validators.presence = composed;
|