2013-09-04 12:39:26 -04:00
|
|
|
// hey Angular, we're bootstrapping manually!
|
|
|
|
window.name = 'NG_DEFER_BOOTSTRAP!';
|
|
|
|
|
2013-09-11 15:01:05 -04:00
|
|
|
require([
|
|
|
|
'angular',
|
2013-09-15 10:24:14 -04:00
|
|
|
'js/controller/login',
|
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-09-11 15:01:05 -04:00
|
|
|
'angularRoute',
|
2013-09-15 10:24:14 -04:00
|
|
|
'angularTouch'
|
2013-10-05 08:16:04 -04:00
|
|
|
], function(angular, LoginCtrl, MailListCtrl, ReadCtrl, WriteCtrl, NavigationCtrl) {
|
2013-09-04 12:39:26 -04:00
|
|
|
'use strict';
|
|
|
|
|
2013-10-16 09:21:23 -04:00
|
|
|
var app = angular.module('mail', ['ngRoute', 'ngTouch', 'navigation', 'mail-list', 'write', 'read']);
|
2013-09-18 12:47:18 -04:00
|
|
|
|
|
|
|
// set router paths
|
2013-09-04 12:39:26 -04:00
|
|
|
app.config(function($routeProvider) {
|
2013-09-15 10:24:14 -04:00
|
|
|
$routeProvider.when('/login', {
|
|
|
|
templateUrl: 'tpl/login.html',
|
|
|
|
controller: LoginCtrl
|
|
|
|
});
|
2013-10-12 13:39:09 -04:00
|
|
|
$routeProvider.when('/write/:folder/:id', {
|
|
|
|
templateUrl: 'tpl/write.html',
|
|
|
|
controller: WriteCtrl
|
|
|
|
});
|
|
|
|
$routeProvider.when('/write', {
|
2013-09-11 15:01:05 -04:00
|
|
|
templateUrl: 'tpl/write.html',
|
|
|
|
controller: WriteCtrl
|
|
|
|
});
|
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
|
|
|
});
|
|
|
|
|
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-09-18 12:47:18 -04:00
|
|
|
app.controller('MailListCtrl', MailListCtrl);
|
|
|
|
|
|
|
|
// manually bootstrap angular due to require.js
|
2013-09-04 12:39:26 -04:00
|
|
|
angular.element().ready(function() {
|
|
|
|
angular.bootstrap(document, ['mail']);
|
|
|
|
});
|
|
|
|
});
|