mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-24 13:41:33 +00:00
Get validation working with address fields and Angular digest loop
This commit is contained in:
parent
2a78a7843a
commit
3731c62e17
2 changed files with 14 additions and 13 deletions
|
@ -128,22 +128,22 @@ block content
|
||||||
hr
|
hr
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.form-group
|
.form-group(ng-class="validation.errorFields.address1 ? 'has-error' : ''")
|
||||||
label #{translate("billing_address")}
|
label #{translate("billing_address")}
|
||||||
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', ng-model="data.address1", placeholder="#{translate('address')}")
|
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', ng-model="data.address1", placeholder="#{translate('address')}")
|
||||||
.form-group
|
.form-group(ng-class="validation.errorFields.address2 ? 'has-error' : ''")
|
||||||
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', ng-model="data.address2", placeholder="#{translate('address')}")
|
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', ng-model="data.address2", placeholder="#{translate('address')}")
|
||||||
.form-group
|
.form-group(ng-class="validation.errorFields.state ? 'has-error' : ''")
|
||||||
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', ng-model="data.state", placeholder="#{translate('state')}")
|
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', ng-model="data.state", placeholder="#{translate('state')}")
|
||||||
.row
|
.row
|
||||||
.col-md-7
|
.col-md-7
|
||||||
.form-group
|
.form-group(ng-class="validation.errorFields.city ? 'has-error' : ''")
|
||||||
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', data-recurly="city", ng-model="data.city", placeholder="#{translate('city')}")
|
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', data-recurly="city", ng-model="data.city", placeholder="#{translate('city')}")
|
||||||
.col-md-5
|
.col-md-5(ng-class="validation.errorFields.postal_code ? 'has-error' : ''")
|
||||||
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', data-recurly="postal_code", ng-model="data.postal_code", placeholder="#{translate('zip_post_code')}")
|
input.form-control(type='text', value='', maxlength='255', tabindex='1', onkeyup='', data-recurly="postal_code", ng-model="data.postal_code", placeholder="#{translate('zip_post_code')}")
|
||||||
.row
|
.row
|
||||||
.col-md-7
|
.col-md-7
|
||||||
.form-group
|
.form-group(ng-class="validation.errorFields.country ? 'has-error' : ''")
|
||||||
select.form-control(data-recurly="country", ng-model="data.country", ng-change="updateCountry()", required)
|
select.form-control(data-recurly="country", ng-model="data.country", ng-change="updateCountry()", required)
|
||||||
mixin countries_options()
|
mixin countries_options()
|
||||||
.row
|
.row
|
||||||
|
|
|
@ -81,6 +81,7 @@ define [
|
||||||
completeSubscription = (err, recurly_token_id) ->
|
completeSubscription = (err, recurly_token_id) ->
|
||||||
$scope.validation.errorFields = {}
|
$scope.validation.errorFields = {}
|
||||||
if err?
|
if err?
|
||||||
|
$scope.$apply () ->
|
||||||
$scope.processing = false
|
$scope.processing = false
|
||||||
$scope.genericError = err.message
|
$scope.genericError = err.message
|
||||||
_.each err.fields, (field)-> $scope.validation.errorFields[field] = true
|
_.each err.fields, (field)-> $scope.validation.errorFields[field] = true
|
||||||
|
|
Loading…
Reference in a new issue