Move the signup form into its own directive
This commit is contained in:
parent
ecabcc3fc6
commit
c24a14b402
4 changed files with 77 additions and 52 deletions
|
@ -107,8 +107,6 @@ function RepoListCtrl($scope, Restangular, UserService) {
|
|||
}
|
||||
|
||||
function LandingCtrl($scope, $timeout, $location, Restangular, UserService, KeyService) {
|
||||
$('.form-signup').popover();
|
||||
|
||||
$scope.namespace = null;
|
||||
|
||||
$scope.$watch('namespace', function(namespace) {
|
||||
|
@ -119,35 +117,6 @@ function LandingCtrl($scope, $timeout, $location, Restangular, UserService, KeyS
|
|||
$scope.user = currentUser;
|
||||
}, true);
|
||||
|
||||
angulartics.waitForVendorApi(mixpanel, 500, function(loadedMixpanel) {
|
||||
var mixpanelId = loadedMixpanel.get_distinct_id();
|
||||
$scope.github_state_clause = '&state=' + mixpanelId;
|
||||
});
|
||||
|
||||
$scope.githubClientId = KeyService.githubClientId;
|
||||
|
||||
$scope.awaitingConfirmation = false;
|
||||
$scope.registering = false;
|
||||
|
||||
$scope.register = function() {
|
||||
$('.form-signup').popover('hide');
|
||||
$scope.registering = true;
|
||||
|
||||
var newUserPost = Restangular.one('user/');
|
||||
newUserPost.customPOST($scope.newUser).then(function() {
|
||||
$scope.awaitingConfirmation = true;
|
||||
$scope.registering = false;
|
||||
|
||||
mixpanel.alias($scope.newUser.username);
|
||||
}, function(result) {
|
||||
$scope.registering = false;
|
||||
$scope.registerError = result.data.message;
|
||||
$timeout(function() {
|
||||
$('.form-signup').popover('show');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.canCreateRepo = function(namespace) {
|
||||
if (!$scope.user) { return false; }
|
||||
|
||||
|
|
Reference in a new issue