pyc-website

main website for pyc inc.

git clone https://9o.is/git/pyc-website.git

commit fd49b2bbf547212d0c4b21a56b2cbd7e426cfe04
parent bdfeeefd3324991020e55c80ce99925f381dfd07
Author: Jul <jul@9o.is>
Date:   Fri, 27 Jun 2014 12:19:32 -0400

moved alertDialog broadcast to AlertMainCtrl

Diffstat:
Msrc/main/webapp/app/App.js | 8++++++--
Msrc/main/webapp/app/controllers/ngAlert.js | 20++++++++++++--------
Msrc/main/webapp/templates-hidden/base-wrap.html | 2+-
3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/main/webapp/app/App.js b/src/main/webapp/app/App.js @@ -197,8 +197,12 @@ app.controller('PhoneVerificationCtrl', ['$scope', '$controller', '$rootScope', $controller('AutoUpdateFormCtrl', {$scope: $scope, $controller: $controller, $rootScope: $rootScope}); $scope.init('PhoneVerification', 'init'); - $scope.updatePostal = function() { - $scope.update('PhoneVerification', 'postal'); + $scope.updatePostal = function() { + var failure = function(alert) { + $rootScope.$broadcast('alertPhoneVerification', alert); + }; + + $scope.update('PhoneVerification', 'postal', function(){}, failure); }; $scope.sentsms = false; diff --git a/src/main/webapp/app/controllers/ngAlert.js b/src/main/webapp/app/controllers/ngAlert.js @@ -15,14 +15,6 @@ angular.module("ngAlert", ['ui.bootstrap']) .controller('AlertCtrl', ['$scope', '$timeout', function($scope, $timeout) { $scope.alerts = []; - - $scope.$on('alertDialog', function(event, alert) { - $scope.addAlert(alert); - }); - - $scope.$on('alertClear', function() { - $scope.clearAlerts(); - }); $scope.addAlert = function(alert) { $scope.alerts = []; @@ -40,4 +32,16 @@ angular.module("ngAlert", ['ui.bootstrap']) $scope.clearAlerts = function() { $scope.alerts = []; }; + }]) + .controller('AlertMainCtrl', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertDialog', function(event, alert) { + $scope.addAlert(alert); + }); + + $scope.$on('alertClear', function() { + $scope.clearAlerts(); + }); + }]); \ No newline at end of file diff --git a/src/main/webapp/templates-hidden/base-wrap.html b/src/main/webapp/templates-hidden/base-wrap.html @@ -74,7 +74,7 @@ </div> <div class="content"> - <div ng-controller="AlertCtrl" ng-cloak> + <div ng-controller="AlertMainCtrl" ng-cloak> <span data-lift="embed?what=/templates-hidden/parts/alert"></span> </div> <div ui-view id="content"></div>