From 9354d61aa3d22143671b06bad1b6c454278acb1e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 28 Jul 2014 16:52:23 +0100 Subject: [PATCH] fixed delete account validation not using angular equals which does not seem to work --- services/web/app/views/user/settings.jade | 8 ++++---- services/web/public/coffee/main/account-settings.coffee | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/services/web/app/views/user/settings.jade b/services/web/app/views/user/settings.jade index c30a377713..ef23470149 100644 --- a/services/web/app/views/user/settings.jade +++ b/services/web/app/views/user/settings.jade @@ -146,16 +146,16 @@ block content input.form-control( type="text", placeholder="", - ng-model="deleteConfirmationText", - equals="DELETE", - focus-on="open" + ng-model="state.deleteText", + focus-on="open", + ng-keyup="checkValidation()" ) .modal-footer button.btn.btn-default( ng-click="cancel()" ) Cancel button.btn.btn-danger( - ng-disabled="deleteAccountForm.$invalid || state.inflight" + ng-disabled="!state.isValid || state.inflight" ng-click="delete()" ) span(ng-hide="state.inflight") Delete diff --git a/services/web/public/coffee/main/account-settings.coffee b/services/web/public/coffee/main/account-settings.coffee index 29cd18e3c5..34b92883b0 100644 --- a/services/web/public/coffee/main/account-settings.coffee +++ b/services/web/public/coffee/main/account-settings.coffee @@ -28,7 +28,9 @@ define [ App.controller "DeleteAccountModalController", [ "$scope", "$modalInstance", "$timeout", "$http", ($scope, $modalInstance, $timeout, $http) -> - $scope.state = + $scope.state = + isValid : false + deleteText: "" inflight: false $modalInstance.opened.then () -> @@ -36,6 +38,9 @@ define [ $scope.$broadcast "open" , 700 + $scope.checkValidation = -> + $scope.state.isValid = $scope.state.deleteText == "DELETE" + $scope.delete = () -> $scope.state.inflight = true