diff --git a/public/index.html b/public/index.html index b503289..5d86d23 100644 --- a/public/index.html +++ b/public/index.html @@ -5,10 +5,14 @@ CloudBudget - - + + + + + +
@@ -48,10 +52,12 @@ + + \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js index 80325c3..c4e3446 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -7,7 +7,7 @@ .module('cloudbudget', ['ngRoute', 'ngAnimate', 'routes', 'angular-growl', 'config', 'ngCookies', 'xeditable']) .constant('apiRoutes', { 'host' : HOST, - 'port' : "80", + 'port' : '80', 'login' : HOST + '/users/login', 'register' : HOST + '/users', 'unregister' : HOST + '/users/', diff --git a/public/js/config.js b/public/js/config.js index 79b91eb..51774f1 100644 --- a/public/js/config.js +++ b/public/js/config.js @@ -5,9 +5,38 @@ .module('config', []) .config(config); - config.$inject = ['growlProvider']; + config.$inject = ['$httpProvider', 'growlProvider']; - function config(growlProvider) { + var regexIso8601 = /^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/; + + function convertDateStringsToDates(input) { + // Ignore things that aren't objects. + if (typeof input !== "object") return input; + + for (var key in input) { + if (!input.hasOwnProperty(key)) continue; + + var value = input[key]; + var match; + // Check for string properties which look like dates. + if (typeof value === "string" && (match = value.match(regexIso8601))) { + var milliseconds = Date.parse(match[0]) + if (!isNaN(milliseconds)) { + input[key] = new Date(milliseconds); + } + } else if (typeof value === "object") { + // Recurse into object + convertDateStringsToDates(value); + } + } +} + + function config($httpProvider, growlProvider) { + $httpProvider.defaults.transformResponse.push(function(responseData){ + convertDateStringsToDates(responseData); + return responseData; + }); + growlProvider.globalReversedOrder(true); growlProvider.globalTimeToLive(5000); growlProvider.globalDisableCountDown(true); diff --git a/public/js/routes.js b/public/js/routes.js index 8c267a0..ccb5eba 100644 --- a/public/js/routes.js +++ b/public/js/routes.js @@ -34,6 +34,12 @@ controllerAs: 'vm' }) + .when('/account/:account_id', { + controller: 'AccountController', + templateUrl: 'account/account.view.html', + controllerAs: 'vm' + }) + .otherwise({redirectTo: '/login'}); $locationProvider.html5Mode(true);