fixed delete account validation

not using angular equals which does not seem to work
This commit is contained in:
Henry Oswald 2014-07-28 16:52:23 +01:00
parent 552cd5ddd4
commit 9354d61aa3
2 changed files with 10 additions and 5 deletions

View file

@ -146,16 +146,16 @@ block content
input.form-control( input.form-control(
type="text", type="text",
placeholder="", placeholder="",
ng-model="deleteConfirmationText", ng-model="state.deleteText",
equals="DELETE", focus-on="open",
focus-on="open" ng-keyup="checkValidation()"
) )
.modal-footer .modal-footer
button.btn.btn-default( button.btn.btn-default(
ng-click="cancel()" ng-click="cancel()"
) Cancel ) Cancel
button.btn.btn-danger( button.btn.btn-danger(
ng-disabled="deleteAccountForm.$invalid || state.inflight" ng-disabled="!state.isValid || state.inflight"
ng-click="delete()" ng-click="delete()"
) )
span(ng-hide="state.inflight") Delete span(ng-hide="state.inflight") Delete

View file

@ -28,7 +28,9 @@ define [
App.controller "DeleteAccountModalController", [ App.controller "DeleteAccountModalController", [
"$scope", "$modalInstance", "$timeout", "$http", "$scope", "$modalInstance", "$timeout", "$http",
($scope, $modalInstance, $timeout, $http) -> ($scope, $modalInstance, $timeout, $http) ->
$scope.state = $scope.state =
isValid : false
deleteText: ""
inflight: false inflight: false
$modalInstance.opened.then () -> $modalInstance.opened.then () ->
@ -36,6 +38,9 @@ define [
$scope.$broadcast "open" $scope.$broadcast "open"
, 700 , 700
$scope.checkValidation = ->
$scope.state.isValid = $scope.state.deleteText == "DELETE"
$scope.delete = () -> $scope.delete = () ->
$scope.state.inflight = true $scope.state.inflight = true