remove remaining angular directives

This commit is contained in:
Quincy Larson
2015-08-19 17:48:24 -07:00
parent a92db3bbf1
commit bfb19668eb

View File

@ -265,8 +265,6 @@ $(document).ready(function() {
});
};
$(window).resize(function(){
reBindModals();
});
@ -389,138 +387,3 @@ $(document).ready(function() {
function defCheck(a){
if(a !== 'undefined'){return(true);}else{return(false);}
}
var profileValidation = angular.module('profileValidation',
['ui.bootstrap']);
profileValidation.controller('profileValidationController', ['$scope', '$http',
function($scope, $http) {
$http.get('/account/api').success(function(data) {
$scope.user = data.user;
$scope.user.username = $scope.user.username ? $scope.user.username.toLowerCase() : undefined;
$scope.storedUsername = data.user.username;
$scope.storedEmail = data.user.email;
$scope.user.email = $scope.user.email ? $scope.user.email.toLowerCase() : undefined;
$scope.user.twitterHandle = $scope.user.twitterHandle ? $scope.user.twitterHandle.toLowerCase() : undefined;
$scope.asyncComplete = true;
});
}
]);
profileValidation.controller('pairedWithController', ['$scope',
function($scope) {
$scope.existingUser = null;
}
]);
profileValidation.controller('emailSignUpController', ['$scope',
function($scope) {
}
]);
profileValidation.controller('emailSignInController', ['$scope',
function($scope) {
}
]);
profileValidation.controller('URLSubmitController', ['$scope',
function($scope) {
}
]);
profileValidation.controller('nonprofitFormController', ['$scope',
function($scope) {
}
]);
profileValidation.controller('doneWithFirst100HoursFormController', ['$scope',
function($scope) {
}
]);
profileValidation.controller('submitStoryController', ['$scope',
function($scope) {
}
]);
profileValidation.directive('uniqueUsername', ['$http', function($http) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind("keyup", function (event) {
ngModel.$setValidity('unique', true);
var username = element.val();
if (username) {
var config = { params: { username: username } };
$http
.get('/api/users/exists', config)
.success(function (result) {
if (username === scope.storedUsername) {
ngModel.$setValidity('unique', true);
} else if (result.exists) {
ngModel.$setValidity('unique', false);
}
});
}
});
}
};
}]);
profileValidation.directive('existingUsername',
['$http', function($http) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind('keyup', function (event) {
if (element.val().length > 0) {
ngModel.$setValidity('exists', false);
} else {
element.removeClass('ng-dirty');
ngModel.$setPristine();
}
var username = element.val();
if (username) {
var config = { params: { username: username } };
$http
.get('/api/users/exists', config)
.success(function(result) {
ngModel.$setValidity('exists', result.exists);
});
}
});
}
};
}]);
profileValidation.directive('uniqueEmail', ['$http', function($http) {
return {
restrict: 'A',
require: 'ngModel',
link: function getUnique (scope, element, attrs, ngModel) {
element.bind("keyup", function (event) {
ngModel.$setValidity('unique', true);
var email = element.val();
if (email) {
var config = { params: { email: email } };
$http
.get('/api/users/exists', config)
.success(function(result) {
if (email === scope.storedEmail) {
ngModel.$setValidity('unique', true);
} else if (result.exists) {
ngModel.$setValidity('unique', false);
}
});
};
});
}
}
}]);