2015-08-16 00:39:53 +02:00

64 lines
2.1 KiB
JavaScript

/*
This file is part of Accountant.
Accountant is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Accountant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
*/
var accountantApp = angular.module("accountantApp", [
'ngResource', 'ngRoute',
"mgcrea.ngStrap",
"highcharts-ng",
"jlareau.pnotify",
"xeditable"
])
.config(function($httpProvider, $routeProvider, $locationProvider) {
$httpProvider.interceptors.push(function($q, notificationService) {
return {
"response": function(response) {
if(response.data.ok === false) {
return $q.reject(response);
}
// TODO Intercept validation error.
return response;
},
"responseError": function(response) {
// TODO Intercept Authentication Required error
notificationService.error(response.data.text);
return $q.reject(response);
}
};
});
$routeProvider.when('/account/:accountId/entries', {
templateUrl: 'static/templates/entries.html',
controller: 'EntryController'
}).when('/account/:accountId/scheduler', {
templateUrl: 'static/templates/scheduler.html',
controller: 'SchedulerController'
}).when('/accounts', {
templateUrl: 'static/templates/accounts.html',
controller: 'AccountController'
}).when('/', {
redirectTo: 'accounts'
});
$locationProvider.html5Mode(true);
})
.run(function(editableOptions) {
editableOptions.theme = 'bs3'; // bootstrap3 theme. Can be also 'bs2', 'default'
})
;