From 08c25b16048be7b62991b8d5bac03b9131a1fd99 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Thu, 27 Mar 2014 16:26:22 +1100 Subject: [PATCH] Getting a success message in place --- .../forgot_sidebar_controller.js.coffee | 5 ++- app/views/shared/_forgot_sidebar.html.haml | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/forgot_sidebar_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/forgot_sidebar_controller.js.coffee index 0ebe1d72e9..f0e708f2f7 100644 --- a/app/assets/javascripts/darkswarm/controllers/forgot_sidebar_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/forgot_sidebar_controller.js.coffee @@ -1,5 +1,6 @@ window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $http, $location, SpreeUser) -> $scope.spree_user = SpreeUser.spree_user + $scope.sent = false $scope.active = -> $location.path() == '/forgot' @@ -10,9 +11,7 @@ window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $h $scope.submit = -> if $scope.spree_user.email != null $http.post("/user/spree_user/password", {spree_user: $scope.spree_user}).success (data)-> - - $location.path("/reset") - + $scope.sent = true .error (data) -> $scope.errors = "Email address not found" else diff --git a/app/views/shared/_forgot_sidebar.html.haml b/app/views/shared/_forgot_sidebar.html.haml index e2e018ff23..0edaee5bbb 100644 --- a/app/views/shared/_forgot_sidebar.html.haml +++ b/app/views/shared/_forgot_sidebar.html.haml @@ -4,18 +4,26 @@ select: "select()"} %form{"ng-submit" => "submit()"} - .alert-box.alert{"ng-show" => "errors != null"} - {{ errors }} + .row .large-12.columns - %label{for: "email"} Email - %input.title.input-text{name: "email", - type: "email", - tabindex: 1, - "ng-model" => "spree_user.email"} - .row - .large-12.columns - %input.button.primary{name: "commit", - tabindex: "3", - type: "submit", - value: "Reset password"} + .alert-box.success.radius{"ng-show" => "sent"} + An email with instructions on resetting your password has been sent! + + %div{"ng-show" => "!sent"} + .alert-box.alert{"ng-show" => "errors != null"} + {{ errors }} + + .row + .large-12.columns + %label{for: "email"} Email + %input.title.input-text{name: "email", + type: "email", + tabindex: 1, + "ng-model" => "spree_user.email"} + .row + .large-12.columns + %input.button.primary{name: "commit", + tabindex: "3", + type: "submit", + value: "Reset password"}