2013-09-04 12:39:26 -04:00
|
|
|
// hey Angular, we're bootstrapping manually!
|
|
|
|
window.name = 'NG_DEFER_BOOTSTRAP!';
|
|
|
|
|
2014-03-02 17:05:09 -05:00
|
|
|
requirejs([
|
2013-09-11 15:01:05 -04:00
|
|
|
'angular',
|
2013-11-08 15:35:30 -05:00
|
|
|
'js/controller/dialog',
|
2013-12-03 07:15:10 -05:00
|
|
|
'js/controller/popover',
|
2014-01-27 12:50:13 -05:00
|
|
|
'js/controller/add-account',
|
2013-10-21 11:10:45 -04:00
|
|
|
'js/controller/account',
|
2014-04-11 12:39:13 -04:00
|
|
|
'js/controller/set-passphrase',
|
2014-03-06 12:19:51 -05:00
|
|
|
'js/controller/contacts',
|
2014-04-15 11:43:33 -04:00
|
|
|
'js/controller/about',
|
2013-09-15 10:24:14 -04:00
|
|
|
'js/controller/login',
|
2013-10-21 07:10:42 -04:00
|
|
|
'js/controller/login-initial',
|
|
|
|
'js/controller/login-new-device',
|
|
|
|
'js/controller/login-existing',
|
2013-09-18 12:47:18 -04:00
|
|
|
'js/controller/mail-list',
|
2013-10-05 08:16:04 -04:00
|
|
|
'js/controller/read',
|
2013-09-11 15:01:05 -04:00
|
|
|
'js/controller/write',
|
2013-09-17 13:11:30 -04:00
|
|
|
'js/controller/navigation',
|
2013-11-27 04:40:55 -05:00
|
|
|
'cryptoLib/util',
|
2014-04-23 06:20:46 -04:00
|
|
|
'js/util/error',
|
2014-03-14 14:10:51 -04:00
|
|
|
'angularSanitize',
|
2013-09-11 15:01:05 -04:00
|
|
|
'angularRoute',
|
2014-04-23 06:20:46 -04:00
|
|
|
'angularTouch',
|
|
|
|
'angularAnimate'
|
2014-03-02 17:05:09 -05:00
|
|
|
], function(
|
|
|
|
angular,
|
|
|
|
DialogCtrl,
|
|
|
|
PopoverCtrl,
|
|
|
|
AddAccountCtrl,
|
|
|
|
AccountCtrl,
|
2014-04-11 12:39:13 -04:00
|
|
|
SetPassphraseCtrl,
|
2014-03-06 12:19:51 -05:00
|
|
|
ContactsCtrl,
|
2014-04-15 11:43:33 -04:00
|
|
|
AboutCtrl,
|
2014-03-02 17:05:09 -05:00
|
|
|
LoginCtrl,
|
|
|
|
LoginInitialCtrl,
|
|
|
|
LoginNewDeviceCtrl,
|
|
|
|
LoginExistingCtrl,
|
|
|
|
MailListCtrl,
|
|
|
|
ReadCtrl,
|
|
|
|
WriteCtrl,
|
|
|
|
NavigationCtrl,
|
2014-04-23 06:20:46 -04:00
|
|
|
util,
|
|
|
|
errorUtil
|
2014-03-06 12:19:51 -05:00
|
|
|
) {
|
2013-09-04 12:39:26 -04:00
|
|
|
'use strict';
|
|
|
|
|
2013-11-27 04:40:55 -05:00
|
|
|
// reset window.name
|
|
|
|
window.name = util.UUID();
|
|
|
|
|
|
|
|
// init main angular module including dependencies
|
2014-03-06 12:19:51 -05:00
|
|
|
var app = angular.module('mail', [
|
2014-03-14 14:10:51 -04:00
|
|
|
'ngSanitize',
|
2014-03-06 12:19:51 -05:00
|
|
|
'ngRoute',
|
|
|
|
'ngTouch',
|
2014-04-23 06:20:46 -04:00
|
|
|
'ngAnimate',
|
2014-03-06 12:19:51 -05:00
|
|
|
'navigation',
|
|
|
|
'mail-list',
|
|
|
|
'write',
|
|
|
|
'read',
|
|
|
|
'contacts',
|
|
|
|
'login-new-device',
|
|
|
|
'popover'
|
|
|
|
]);
|
2013-09-18 12:47:18 -04:00
|
|
|
|
|
|
|
// set router paths
|
2013-09-04 12:39:26 -04:00
|
|
|
app.config(function($routeProvider) {
|
2014-01-27 12:50:13 -05:00
|
|
|
$routeProvider.when('/add-account', {
|
|
|
|
templateUrl: 'tpl/add-account.html',
|
|
|
|
controller: AddAccountCtrl
|
|
|
|
});
|
2013-09-15 10:24:14 -04:00
|
|
|
$routeProvider.when('/login', {
|
2013-11-04 08:20:14 -05:00
|
|
|
templateUrl: 'tpl/login.html',
|
2013-09-15 10:24:14 -04:00
|
|
|
controller: LoginCtrl
|
|
|
|
});
|
2013-10-21 07:10:42 -04:00
|
|
|
$routeProvider.when('/login-existing', {
|
|
|
|
templateUrl: 'tpl/login-existing.html',
|
|
|
|
controller: LoginExistingCtrl
|
|
|
|
});
|
|
|
|
$routeProvider.when('/login-initial', {
|
|
|
|
templateUrl: 'tpl/login-initial.html',
|
|
|
|
controller: LoginInitialCtrl
|
|
|
|
});
|
|
|
|
$routeProvider.when('/login-new-device', {
|
|
|
|
templateUrl: 'tpl/login-new-device.html',
|
|
|
|
controller: LoginNewDeviceCtrl
|
|
|
|
});
|
2013-09-17 13:11:30 -04:00
|
|
|
$routeProvider.when('/desktop', {
|
|
|
|
templateUrl: 'tpl/desktop.html',
|
|
|
|
controller: NavigationCtrl
|
|
|
|
});
|
2013-09-06 18:34:36 -04:00
|
|
|
$routeProvider.otherwise({
|
2013-09-19 09:41:21 -04:00
|
|
|
redirectTo: '/login'
|
2013-09-06 18:34:36 -04:00
|
|
|
});
|
2013-09-04 12:39:26 -04:00
|
|
|
});
|
|
|
|
|
2014-04-23 06:20:46 -04:00
|
|
|
app.run(function($rootScope) {
|
|
|
|
// global state... inherited to all child scopes
|
|
|
|
$rootScope.state = {};
|
|
|
|
// attach global error handler
|
|
|
|
errorUtil.attachHandler($rootScope);
|
|
|
|
});
|
|
|
|
|
2013-09-18 12:47:18 -04:00
|
|
|
// inject controllers from ng-included view templates
|
2013-10-05 08:16:04 -04:00
|
|
|
app.controller('ReadCtrl', ReadCtrl);
|
2013-10-18 20:58:53 -04:00
|
|
|
app.controller('WriteCtrl', WriteCtrl);
|
2013-09-18 12:47:18 -04:00
|
|
|
app.controller('MailListCtrl', MailListCtrl);
|
2013-10-21 11:10:45 -04:00
|
|
|
app.controller('AccountCtrl', AccountCtrl);
|
2014-04-11 12:39:13 -04:00
|
|
|
app.controller('SetPassphraseCtrl', SetPassphraseCtrl);
|
2014-03-06 12:19:51 -05:00
|
|
|
app.controller('ContactsCtrl', ContactsCtrl);
|
2014-04-15 11:43:33 -04:00
|
|
|
app.controller('AboutCtrl', AboutCtrl);
|
2013-11-08 15:35:30 -05:00
|
|
|
app.controller('DialogCtrl', DialogCtrl);
|
2013-12-03 07:15:10 -05:00
|
|
|
app.controller('PopoverCtrl', PopoverCtrl);
|
2013-09-18 12:47:18 -04:00
|
|
|
|
|
|
|
// manually bootstrap angular due to require.js
|
2013-09-04 12:39:26 -04:00
|
|
|
angular.element().ready(function() {
|
|
|
|
angular.bootstrap(document, ['mail']);
|
|
|
|
});
|
|
|
|
});
|