remove remaining angular directives
This commit is contained in:
@ -265,8 +265,6 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
reBindModals();
|
reBindModals();
|
||||||
});
|
});
|
||||||
@ -389,138 +387,3 @@ $(document).ready(function() {
|
|||||||
function defCheck(a){
|
function defCheck(a){
|
||||||
if(a !== 'undefined'){return(true);}else{return(false);}
|
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}]);
|
|
||||||
|
Reference in New Issue
Block a user