From c24a14b402934163468b98fa1166329fddbf9ba9 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 11 Dec 2013 16:50:10 -0500 Subject: [PATCH] Move the signup form into its own directive --- static/directives/signup-form.html | 29 ++++++++++++++++++ static/js/app.js | 47 ++++++++++++++++++++++++++++++ static/js/controllers.js | 31 -------------------- static/partials/landing.html | 22 +------------- 4 files changed, 77 insertions(+), 52 deletions(-) create mode 100644 static/directives/signup-form.html diff --git a/static/directives/signup-form.html b/static/directives/signup-form.html new file mode 100644 index 000000000..0d435d2ab --- /dev/null +++ b/static/directives/signup-form.html @@ -0,0 +1,29 @@ +
+ +
+ +
+
+
+ Thank you for registering! We have sent you an activation email. + You must verify your email address before you can continue.
+
+
diff --git a/static/js/app.js b/static/js/app.js index cdc3ddabf..38df8bc57 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -579,6 +579,53 @@ quayApp.directive('signinForm', function () { }); +quayApp.directive('signupForm', function () { + var directiveDefinitionObject = { + priority: 0, + templateUrl: '/static/directives/signup-form.html', + replace: false, + transclude: true, + restrict: 'C', + scope: { + + }, + controller: function($scope, $location, $timeout, Restangular, KeyService, UserService) { + $('.form-signup').popover(); + + 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'); + }); + }); + }; + } + }; + return directiveDefinitionObject; +}); + + quayApp.directive('plansTable', function () { var directiveDefinitionObject = { priority: 0, diff --git a/static/js/controllers.js b/static/js/controllers.js index b3f8a5b90..9abf343df 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -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; } diff --git a/static/partials/landing.html b/static/partials/landing.html index d805f94bb..714ccabe2 100644 --- a/static/partials/landing.html +++ b/static/partials/landing.html @@ -36,27 +36,7 @@
- -
- -
-
-
Thank you for registering! We have sent you an activation email. You must verify your email address before you can continue.
-
+