Working signup :)

This commit is contained in:
Will Marshall
2014-03-21 13:53:35 +11:00
parent 40d1563cd9
commit b623a64fb4
2 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,8 @@
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope) ->
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope, $http) ->
$scope.spree_user = {}
$scope.errors =
email: null
password: null
$scope.active = ->
$scope.active_sidebar == '/signup'
@@ -8,4 +11,4 @@ window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope) ->
$http.post("/user/spree_user", {spree_user: $scope.spree_user}).success (data)->
location.href = location.origin + location.pathname # Strips out hash fragments
.error (data) ->
$scope.errors = data.message
$scope.errors = data

View File

@@ -1,8 +1,6 @@
#sign-up-content{"ng-controller" => "SignupSidebarCtrl", "ng-show" => "active()"}
%h2 Signup
%form{"ng-submit" => "submit()"}
.alert-box.alert{"ng-show" => "errors != null"}
{{ errors }}
.row
.large-12.columns
%label{for: "email"} Email
@@ -10,6 +8,8 @@
type: "email",
tabindex: 1,
"ng-model" => "spree_user.email"}
%span.error{"ng-show" => "errors.email != null"}
{{ errors.email.join(' ') }}
.row
.large-12.columns
%label{for: "password"} Password
@@ -18,6 +18,8 @@
autocomplete: "off",
tabindex: 2,
"ng-model" => "spree_user.password"}
%span.error{"ng-show" => "errors.password != null"}
{{ errors.password.join(' ') }}
.row
.large-12.columns
%label{for: "password"} Password Confirmation