From 6adc9da8c12bdd27c7a50caca28dac830fd6b67b Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Wed, 23 Apr 2014 12:20:46 +0200 Subject: [PATCH] Cleanup before refactor with ngAnimate * Add ng-animate module in libs * Move error dialog init to app.run * Include error dialog template only once in index.html * Fix race condition between ng-repeat, ng-class using ng-animate --- src/chrome.html | 9 ++++++++- src/ios.html | 7 +++++++ src/js/app.js | 15 ++++++++++++-- src/js/controller/add-account.js | 8 +------- src/js/controller/login-existing.js | 8 +------- src/js/controller/login-initial.js | 8 +------- src/js/controller/login-new-device.js | 6 ------ src/js/controller/login.js | 8 +------- src/js/controller/navigation.js | 6 ------ src/js/util/error.js | 2 +- src/lib/angular/angular-animate.min.js | 27 ++++++++++++++++++++++++++ src/require-config.js | 5 +++++ src/sass/views/_dialog.scss | 1 - src/tpl/add-account.html | 5 ----- src/tpl/desktop.html | 3 --- src/tpl/login-existing.html | 5 ----- src/tpl/login-initial.html | 5 ----- src/tpl/login-new-device.html | 7 +------ src/tpl/login.html | 5 ----- src/tpl/read.html | 12 +++++++++--- 20 files changed, 75 insertions(+), 77 deletions(-) create mode 100755 src/lib/angular/angular-animate.min.js diff --git a/src/chrome.html b/src/chrome.html index 4fadb62..3c91d94 100644 --- a/src/chrome.html +++ b/src/chrome.html @@ -12,8 +12,15 @@ - + +
+ + + + diff --git a/src/ios.html b/src/ios.html index b1b708d..20fa363 100644 --- a/src/ios.html +++ b/src/ios.html @@ -20,6 +20,13 @@ +
+ + + + diff --git a/src/js/app.js b/src/js/app.js index 3669788..18f12f1 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -19,9 +19,11 @@ requirejs([ 'js/controller/write', 'js/controller/navigation', 'cryptoLib/util', + 'js/util/error', 'angularSanitize', 'angularRoute', - 'angularTouch' + 'angularTouch', + 'angularAnimate' ], function( angular, DialogCtrl, @@ -39,7 +41,8 @@ requirejs([ ReadCtrl, WriteCtrl, NavigationCtrl, - util + util, + errorUtil ) { 'use strict'; @@ -51,6 +54,7 @@ requirejs([ 'ngSanitize', 'ngRoute', 'ngTouch', + 'ngAnimate', 'navigation', 'mail-list', 'write', @@ -91,6 +95,13 @@ requirejs([ }); }); + app.run(function($rootScope) { + // global state... inherited to all child scopes + $rootScope.state = {}; + // attach global error handler + errorUtil.attachHandler($rootScope); + }); + // inject controllers from ng-included view templates app.controller('ReadCtrl', ReadCtrl); app.controller('WriteCtrl', WriteCtrl); diff --git a/src/js/controller/add-account.js b/src/js/controller/add-account.js index cbcf2c0..6c3c479 100644 --- a/src/js/controller/add-account.js +++ b/src/js/controller/add-account.js @@ -1,15 +1,9 @@ define(function(require) { 'use strict'; - var appController = require('js/app-controller'), - errorUtil = require('js/util/error'); + var appController = require('js/app-controller'); var AddAccountCtrl = function($scope, $location) { - // global state... inherited to all child scopes - $scope.$root.state = {}; - // attach global error handler - errorUtil.attachHandler($scope); - $scope.connectToGoogle = function() { appController._auth.getCredentials({}, function(err) { if (err) { diff --git a/src/js/controller/login-existing.js b/src/js/controller/login-existing.js index 9fd14b3..4fe0bd2 100644 --- a/src/js/controller/login-existing.js +++ b/src/js/controller/login-existing.js @@ -1,15 +1,9 @@ define(function(require) { 'use strict'; - var appController = require('js/app-controller'), - errorUtil = require('js/util/error'); + var appController = require('js/app-controller'); var LoginExistingCtrl = function($scope, $location) { - // global state... inherited to all child scopes - $scope.$root.state = {}; - // attach global error handler - errorUtil.attachHandler($scope); - var emailDao = appController._emailDao; $scope.buttonEnabled = true; diff --git a/src/js/controller/login-initial.js b/src/js/controller/login-initial.js index c557af0..c6588ff 100644 --- a/src/js/controller/login-initial.js +++ b/src/js/controller/login-initial.js @@ -1,18 +1,12 @@ define(function(require) { 'use strict'; - var appController = require('js/app-controller'), - errorUtil = require('js/util/error'); + var appController = require('js/app-controller'); var LoginInitialCtrl = function($scope, $location) { var emailDao = appController._emailDao, states, termsMsg = 'You must accept the Terms of Service to continue.'; - // global state... inherited to all child scopes - $scope.$root.state = {}; - // attach global error handler - errorUtil.attachHandler($scope); - states = { IDLE: 1, PROCESSING: 2, diff --git a/src/js/controller/login-new-device.js b/src/js/controller/login-new-device.js index 9125dc5..f3f274b 100644 --- a/src/js/controller/login-new-device.js +++ b/src/js/controller/login-new-device.js @@ -2,15 +2,9 @@ define(function(require) { 'use strict'; var angular = require('angular'), - errorUtil = require('js/util/error'), appController = require('js/app-controller'); var LoginExistingCtrl = function($scope, $location) { - // global state... inherited to all child scopes - $scope.$root.state = {}; - // attach global error handler - errorUtil.attachHandler($scope); - var emailDao = appController._emailDao, pgp = appController._crypto; diff --git a/src/js/controller/login.js b/src/js/controller/login.js index 39fd912..ac96b47 100644 --- a/src/js/controller/login.js +++ b/src/js/controller/login.js @@ -1,15 +1,9 @@ define(function(require) { 'use strict'; - var appController = require('js/app-controller'), - errorUtil = require('js/util/error'); + var appController = require('js/app-controller'); var LoginCtrl = function($scope, $location) { - // global state... inherited to all child scopes - $scope.$root.state = {}; - // attach global error handler - errorUtil.attachHandler($scope); - // check for app update appController.checkForUpdate(); diff --git a/src/js/controller/navigation.js b/src/js/controller/navigation.js index 2de2e5e..736e7d0 100644 --- a/src/js/controller/navigation.js +++ b/src/js/controller/navigation.js @@ -4,7 +4,6 @@ define(function(require) { var angular = require('angular'), str = require('js/app-config').string, appController = require('js/app-controller'), - errorUtil = require('js/util/error'), notification = require('js/util/notification'), _ = require('underscore'), emailDao, outboxBo; @@ -14,11 +13,6 @@ define(function(require) { // var NavigationCtrl = function($scope) { - // global state... inherited to all child scopes - $scope.$root.state = {}; - // attach global error handler - errorUtil.attachHandler($scope); - emailDao = appController._emailDao; outboxBo = appController._outboxBo; diff --git a/src/js/util/error.js b/src/js/util/error.js index 05749a6..ba9b8bd 100644 --- a/src/js/util/error.js +++ b/src/js/util/error.js @@ -4,7 +4,7 @@ define(function() { var er = {}; er.attachHandler = function(scope) { - scope.$root.onError = function(options) { + scope.onError = function(options) { if (!options) { scope.$apply(); return; diff --git a/src/lib/angular/angular-animate.min.js b/src/lib/angular/angular-animate.min.js new file mode 100755 index 0000000..4502865 --- /dev/null +++ b/src/lib/angular/angular-animate.min.js @@ -0,0 +1,27 @@ +/* + AngularJS v1.2.13 + (c) 2010-2014 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(z,f,T){'use strict';f.module("ngAnimate",["ng"]).factory("$$animateReflow",["$window","$timeout","$document",function(f,h,d){var n=f.requestAnimationFrame||f.webkitRequestAnimationFrame||function(d){return h(d,10,!1)},w=f.cancelAnimationFrame||f.webkitCancelAnimationFrame||function(d){return h.cancel(d)};return function(d){var f=n(function(){d()});return function(){w(f)}}}]).factory("$$asyncQueueBuffer",["$timeout",function(f){var h,d=[];return function(n){f.cancel(h);d.push(n);h=f(function(){for(var f= +0;f= +u&&a>=s&&e()}var h=d(a);b=a.data(E);if(-1!=h.className.indexOf(c)&&b){var l="";D(c.split(" "),function(b,a){l+=(0 - - -
diff --git a/src/tpl/desktop.html b/src/tpl/desktop.html index 2a659ec..9821fcb 100644 --- a/src/tpl/desktop.html +++ b/src/tpl/desktop.html @@ -33,7 +33,4 @@
- \ No newline at end of file diff --git a/src/tpl/login-existing.html b/src/tpl/login-existing.html index 445c723..480e451 100644 --- a/src/tpl/login-existing.html +++ b/src/tpl/login-existing.html @@ -18,11 +18,6 @@ - - -
diff --git a/src/tpl/login-initial.html b/src/tpl/login-initial.html index 08c6162..391ee9b 100644 --- a/src/tpl/login-initial.html +++ b/src/tpl/login-initial.html @@ -33,11 +33,6 @@
- - -
diff --git a/src/tpl/login-new-device.html b/src/tpl/login-new-device.html index f123a2b..bfeb0aa 100644 --- a/src/tpl/login-new-device.html +++ b/src/tpl/login-new-device.html @@ -5,7 +5,7 @@

Import keyfile. To access your emails on this device, please import your existing key file.

- +
@@ -20,11 +20,6 @@
- - -
diff --git a/src/tpl/login.html b/src/tpl/login.html index dec01ee..094c581 100644 --- a/src/tpl/login.html +++ b/src/tpl/login.html @@ -8,9 +8,4 @@

Login. Authenticating with the mail server...

-
- - - \ No newline at end of file diff --git a/src/tpl/read.html b/src/tpl/read.html index 9b8a441..db2ad5b 100644 --- a/src/tpl/read.html +++ b/src/tpl/read.html @@ -11,15 +11,21 @@

- {{u.name || u.address}} + + {{u.name || u.address}} +

- {{u.name || u.address}} + + {{u.name || u.address}} +

- {{u.name || u.address}} + + {{u.name || u.address}} +