pyc-website
main website for pyc inc.
git clone https://9o.is/git/pyc-website.git
commit a3b0c72d2efb1bc9de8ff2c118e97c4b04f02481 parent b1c0e9a50e4ac134400a092ea4baf3f269ac8389 Author: Jul <jul@9o.is> Date: Tue, 24 Jun 2014 11:26:52 -0400 Now using sub-alerts so the user won't miss any alerts for sure Diffstat:
| M | src/main/webapp/app/App.js | | | 111 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------- |
| M | src/main/webapp/less/overrides.less | | | 2 | +- |
| M | src/main/webapp/templates-hidden/base-wrap.html | | | 9 | +++++++-- |
| M | src/main/webapp/templates-hidden/parts/alert.html | | | 10 | ++++------ |
| M | src/main/webapp/templates-hidden/parts/apply-atm-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/change-password-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/forgot-password-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/id-verification-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/notify-atm-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/user-login-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/user-registration-form.html | | | 4 | ++++ |
| M | src/main/webapp/templates-hidden/parts/user-settings-email-form.html | | | 7 | ++++++- |
12 files changed, 136 insertions(+), 31 deletions(-)
diff --git a/src/main/webapp/app/App.js b/src/main/webapp/app/App.js @@ -7,6 +7,14 @@ var ZIP_CODE_REGEXP = /^(\d{5}(-\d{4})?|[A-Z]\d[A-Z] *\d[A-Z]\d)$/; var PASSWORD_REGEXP = /^(?=.*[^a-zA-Z])\S{8,}$/; var UNSAFE_URL_REGEXP = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/; +app.controller('NearAtmNotifyAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertNearAtm', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + app.controller('NearAtmNotifyCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('FormCtrl', {$scope: $scope}); @@ -14,71 +22,103 @@ app.controller('NearAtmNotifyCtrl', ['$scope', '$controller', '$rootScope', func $scope.save = function() { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertNearAtm', alert); $scope.reset(); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertNearAtm', alert); }; $scope.submit('NearAtmNotify', 'submit', success, failure); }; }]); -app.controller('AtmApplicationCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { +app.controller('AtmApplicationAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertAtmApp', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + +app.controller('AtmApplicationCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('FormCtrl', {$scope: $scope}); $scope.url_regex = UNSAFE_URL_REGEXP; $scope.save = function() { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertAtmApp', alert); $scope.reset(); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertAtmApp', alert); }; $scope.submit('AtmApplication', 'submit', success, failure); }; }]); +app.controller('UserRegistrationAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertUserRegister', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + app.controller('UserRegistrationCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('FormCtrl', {$scope: $scope}); $scope.save = function() { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertUserRegister', alert); $scope.reset(); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertUserRegister', alert); }; $scope.submit('UserRegistration', 'submit', success, failure); }; }]); +app.controller('PasswordRecoveryAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertPasswordRecover', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + app.controller('PasswordRecoveryCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('FormCtrl', {$scope: $scope}); $scope.save = function() { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertPasswordRecover', alert); $scope.reset(); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertPasswordRecover', alert); }; $scope.submit('PasswordRecovery', 'submit', success, failure); }; }]); +app.controller('UserLoginAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertUserLogin', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + app.controller('UserLoginCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('FormCtrl', {$scope: $scope}); @@ -90,7 +130,7 @@ app.controller('UserLoginCtrl', ['$scope', '$controller', '$rootScope', function }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertUserLogin', alert); }; $scope.submit('UserLogin', 'submit', success, failure); @@ -116,6 +156,15 @@ app.controller('FindAtmCtrl', ['$scope', '$state', '$rootScope', '$controller', }; }]); + +app.controller('PasswordChangeAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertPasswordChange', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + app.controller('PasswordChangeCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('FormCtrl', {$scope: $scope}); @@ -123,19 +172,28 @@ app.controller('PasswordChangeCtrl', ['$scope', '$controller', '$rootScope', fun $scope.save = function() { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertPasswordChange', alert); $scope.reset(); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertPasswordChange', alert); }; $scope.submit('PasswordChange', 'submit', success, failure); }; }]); -app.controller('IdVerificationCtrl', ['$scope', '$controller', '$rootScope', '$fileUploader', '$state', function($scope, $controller, $rootScope, $fileUploader, $state) { + +app.controller('IdVerificationAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertIdVerification', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + +app.controller('IdVerificationCtrl', ['$scope', '$controller', '$rootScope', '$fileUploader', function($scope, $controller, $rootScope, $fileUploader) { $controller('LoadedFormCtrl', {$scope: $scope, $controller: $controller}); $scope.init('IdVerification', 'init'); @@ -165,21 +223,23 @@ app.controller('IdVerificationCtrl', ['$scope', '$controller', '$rootScope', '$f }; $scope.uploader.bind('whenaddingfilefailed', function () { - $rootScope.$broadcast('alertDialog', {type: "danger", msg: "Your file could not be added."}); + $rootScope.$broadcast('alertIdVerification', {type: "danger", msg: "Your file could not be added."}); }); $scope.uploader.bind('error', function () { - $rootScope.$broadcast('alertDialog', {type: "danger", msg: "Your files could not be uploaded. Please try again."}); + $rootScope.$broadcast('alertIdVerification', {type: "danger", msg: "Your files could not be uploaded. Please try again."}); }); $scope.uploader.bind('success', function () { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); - $state.go($state.$current, null, { reload: true }); + $rootScope.$broadcast('alertIdVerification', alert); + //$state.go($state.$current, null, { reload: true }); + $scope.uploader.clearQueue(); + $scope.reset(); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertIdVerification', alert); }; $scope.submit('IdVerification', 'submit', success, failure); @@ -212,18 +272,27 @@ app.controller('UserSettingsCtrl', ['$scope', '$controller', '$rootScope', funct $scope.update('UserSettings', funcName); }; }]); + + +app.controller('UserSettingsEmailAlert', ['$scope', '$controller', function($scope, $controller) { + $controller('AlertCtrl', {$scope: $scope}); + + $scope.$on('alertUserSettingsEmail', function(event, alert) { + $scope.addAlert(alert); + }); +}]); + app.controller('UserSettingsEmailCtrl', ['$scope', '$controller', '$rootScope', function($scope, $controller, $rootScope) { $controller('LoadedFormCtrl', {$scope: $scope, $controller: $controller}); $scope.init('UserSettingsEmail', 'init'); $scope.save = function() { var success = function(alert) { - $rootScope.$broadcast('alertDialog', alert); - $scope.reset(); + $rootScope.$broadcast('alertUserSettingsEmail', alert); }; var failure = function(alert) { - $rootScope.$broadcast('alertDialog', alert); + $rootScope.$broadcast('alertUserSettingsEmail', alert); }; $scope.submit('UserSettingsEmail', 'submit', success, failure); diff --git a/src/main/webapp/less/overrides.less b/src/main/webapp/less/overrides.less @@ -8,7 +8,7 @@ body { > .container { padding: 0; - > #content, > footer { + > .content, > footer { border-left: 1px solid @brand-primary; border-right: 1px solid @brand-primary; background: @white; diff --git a/src/main/webapp/templates-hidden/base-wrap.html b/src/main/webapp/templates-hidden/base-wrap.html @@ -72,8 +72,13 @@ </div> </div> </div> - <span data-lift="embed?what=/templates-hidden/parts/alert"></span> - <div ui-view id="content"></div> + + <div class="content"> + <div ng-controller="AlertCtrl" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <div ui-view id="content"></div> + </div> <span data-lift="embed?what=/templates-hidden/parts/footer"></span> </div> diff --git a/src/main/webapp/templates-hidden/parts/alert.html b/src/main/webapp/templates-hidden/parts/alert.html @@ -1,5 +1,3 @@ -<div ng-controller="AlertCtrl" ng-cloak> - <alert class="alert alert-{{alert.type}}" ng-repeat="alert in alerts" close="closeAlert($index)"> - <div bind-html-unsafe="alert.msg"></div> - </alert> -</div> -\ No newline at end of file +<alert class="alert alert-{{alert.type}}" ng-repeat="alert in alerts" close="closeAlert($index)"> + <div bind-html-unsafe="alert.msg"></div> +</alert> +\ No newline at end of file diff --git a/src/main/webapp/templates-hidden/parts/apply-atm-form.html b/src/main/webapp/templates-hidden/parts/apply-atm-form.html @@ -69,6 +69,10 @@ </fieldset> <footer> + <div ng-controller="AtmApplicationAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid" disabler ng-model="loading">Apply for Bitcoin ATM</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/change-password-form.html b/src/main/webapp/templates-hidden/parts/change-password-form.html @@ -20,6 +20,10 @@ </fieldset> <footer> + <div ng-controller="PasswordChangeAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid" disabler ng-model="loading">Change Password</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/forgot-password-form.html b/src/main/webapp/templates-hidden/parts/forgot-password-form.html @@ -12,6 +12,10 @@ </fieldset> <footer> + <div ng-controller="PasswordRecoveryAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid" disabler ng-model="loading">Reset Password</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/id-verification-form.html b/src/main/webapp/templates-hidden/parts/id-verification-form.html @@ -88,6 +88,10 @@ </fieldset> <footer> + <div ng-controller="IdVerificationAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid || filesRequired()" disabler ng-model="loading">Verify My Identity</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/notify-atm-form.html b/src/main/webapp/templates-hidden/parts/notify-atm-form.html @@ -53,6 +53,10 @@ </fieldset> <footer> + <div ng-controller="NearAtmNotifyAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid" disabler ng-model="loading">Notify Me</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/user-login-form.html b/src/main/webapp/templates-hidden/parts/user-login-form.html @@ -30,6 +30,10 @@ </fieldset> <footer> + <div ng-controller="UserLoginAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid" disabler ng-model="loading"><i class="fa fa-lock fa-fw"></i>Log In</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/user-registration-form.html b/src/main/webapp/templates-hidden/parts/user-registration-form.html @@ -34,6 +34,10 @@ </fieldset> <footer> + <div ng-controller="UserRegistrationAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid" disabler ng-model="loading"><i class="fa fa-lock fa-fw"></i>Register</button> </footer> </form> diff --git a/src/main/webapp/templates-hidden/parts/user-settings-email-form.html b/src/main/webapp/templates-hidden/parts/user-settings-email-form.html @@ -3,13 +3,18 @@ <fieldset> <section> <label>Email Address</label> - <label class="input" ng-class="{{ stateSuccessError('email') }}"> + <label class="input" ng-class="{{ stateSuccessError('email') }}"> + <i class="icon-append fa fa-envelope-o"></i> <input name="email" ng-model="model.email" type="email"> </label> </section> </fieldset> <footer> + <div ng-controller="UserSettingsEmailAlert" ng-cloak> + <span data-lift="embed?what=/templates-hidden/parts/alert"></span> + </div> + <button type="submit" class="btn btn-primary" ng-disabled="form.$invalid || form.$pristine" disabler ng-model="loading">Change Email Address</button> </footer> </form>