Permalink
Comparing changes
Open a pull request
- 1 commit
- 5 files changed
- 0 commit comments
- 1 contributor
Unified
Split
Showing
with
22 additions
and 8 deletions.
- +5 −0 h/static/scripts/auth/auth.coffee
- +4 −1 h/static/scripts/controllers/account-management.coffee
- +1 −1 h/static/scripts/directives/status-button.coffee
- +4 −2 h/templates/account.html
- +8 −4 h/templates/auth.html
| @@ -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)) | ||
| @@ -38,7 +38,8 @@ <h2 class="form-heading"><span>Change Your Password</span></h2> | ||
| <div class="form-actions"> | ||
| <div class="form-actions-buttons"> | ||
| <button class="btn" type="submit">Update</button> | ||
| <button class="btn" type="submit" | ||
| status-button="changePasswordForm">Update</button> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| @@ -59,7 +60,8 @@ <h2 class="form-heading"><span>Delete Account</span></h2> | ||
| <div class="form-actions"> | ||
| <div class="form-actions-buttons"> | ||
| <button class="btn btn-danger" type="submit">Delete Account</button> | ||
| <button class="btn btn-danger" type="submit" | ||
| status-button="deleteAccountForm">Delete Account</button> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| @@ -47,7 +47,8 @@ | ||
| >have an activation code?</a> | ||
| </div> | ||
| <div class="form-actions-buttons"> | ||
| <button class="btn btn-primary" type="submit" name="login">Sign in</button> | ||
| <button class="btn btn-primary" type="submit" name="login" | ||
| status-button="login">Sign in</button> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| @@ -126,7 +127,8 @@ | ||
| <div class="form-actions"> | ||
| <div class="form-actions-buttons"> | ||
| <button class="btn" type="submit" name="sign_up">Sign up</button> | ||
| <button class="btn" type="submit" name="sign_up" | ||
| status-button="register">Sign up</button> | ||
| </div> | ||
| </div> | ||
| @@ -159,7 +161,8 @@ | ||
| <div class="form-actions"> | ||
| <div class="form-actions-buttons"> | ||
| <button class="btn" type="submit" name="forgot">Request access</button> | ||
| <button class="btn" type="submit" name="forgot" | ||
| status-button="forgot">Request access</button> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| @@ -210,7 +213,8 @@ | ||
| <div class="form-actions"> | ||
| <div class="form-actions-buttons"> | ||
| <button class="btn" type="submit" name="activate">Activate</button> | ||
| <button class="btn" type="submit" name="activate" | ||
| status-button="activate">Activate</button> | ||
| </div> | ||
| </div> | ||
| </form> | ||