Commit 5e48d324 authored by Randall Leeds's avatar Randall Leeds

Show spinner on account and auth form submits

Close #1213
parent 7f693bfa
......@@ -31,6 +31,11 @@ class AuthController
angular.bind(this, failure, form)
session.$resolved = false
# Update status btn
$scope.$broadcast 'formState', form.$name, 'loading'
session.$promise.finally ->
$scope.$broadcast 'formState', form.$name, ''
$scope.$on '$destroy', ->
if timeout
$timeout.cancel timeout
......
......@@ -14,7 +14,7 @@ class AccountManagement
form.$setPristine()
formModel = form.$name.slice(0, -4)
$scope[formModel] = {} # Reset form fields.
$scope.$broadcast 'formState', form.$name, 'success' # Update status btn
onDelete = (form, response) ->
identity.logout()
......@@ -29,6 +29,8 @@ class AccountManagement
else
flash('error', 'Sorry, we were unable to perform your request')
$scope.$broadcast 'formState', form.$name, '' # Update status btn
# Data for each of the forms
$scope.editProfile = {}
$scope.changePassword = {}
......@@ -67,6 +69,7 @@ class AccountManagement
successHandler = angular.bind(null, onSuccess, form)
errorHandler = angular.bind(null, onError, form)
$scope.$broadcast 'formState', form.$name, 'loading' # Update status btn
promise = profile.edit_profile(packet)
promise.$promise.then(successHandler, errorHandler)
......
......@@ -29,7 +29,7 @@ statusButton = ->
unless targetForm
throw new Error('status-button attribute should provide a form name')
elem = angular.element(template)
elem = angular.element(template).attr(STATE_ATTRIBUTE, '')
placeholder.after(elem)
transclude(scope, (clone) -> elem.append(clone))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment