remove default stubs

This commit is contained in:
Gwenhael Le Moine 2014-07-30 20:48:32 +02:00
parent 7bc04b3ddf
commit af352d2533
11 changed files with 69 additions and 39 deletions

View file

@ -1,3 +1,4 @@
app.controller('NavbarCtrl', function($scope) {
$scope.items = ['Home', 'About', 'Contact'];
});
app.controller( 'NavbarCtrl',
function( $scope ) {
$scope.items = [ 'Balance' ];
} );

View file

@ -1,7 +1,7 @@
// Application Level State
app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when('', '/home');
$urlRouterProvider.when('', '/balance');
$stateProvider
@ -9,13 +9,13 @@ app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $ur
url: '',
controller: 'AppCtrl',
views: {
'navbar': {
templateUrl: 'js/core/templates/navbar.tpl.html',
controller: 'NavbarCtrl'
},
'main': {
templateUrl: 'js/core/templates/main.tpl.html'
}
'navbar': {
templateUrl: 'js/core/templates/navbar.tpl.html',
controller: 'NavbarCtrl'
},
'main': {
templateUrl: 'js/core/templates/main.tpl.html'
}
}
})
.state('404', {
@ -24,4 +24,4 @@ app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $ur
controller: 'AppCtrl'
});
}]);
}]);

View file

@ -1,3 +0,0 @@
app.controller('AboutCtrl', ['$scope', function($scope) {
}]);

View file

@ -0,0 +1,26 @@
app.controller( 'BalanceCtrl',
[ '$scope', '$http',
function( $scope, $http ) {
var now = new Date();
$scope.xFunction = function() {
return function( d ) {
return d.account;
};
};
$scope.yFunction = function() {
return function( d ) {
return d.amount;
};
};
$scope.balance = { expenses: [],
income: [] };
$http.get( '/api/ledger/balance?period=' + now.getFullYear() + '-' + now.getMonth() + '&categories=Expenses' )
.then( function( response ) {
$scope.balance.expenses = response.data;
} );
$http.get( '/api/ledger/balance?period=' + now.getFullYear() + '-' + now.getMonth() + '&categories=Income' )
.then( function( response ) {
$scope.balance.income = response.data;
} );
}]);

View file

@ -1,3 +0,0 @@
app.controller('ContactCtrl', ['$scope', function($scope) {
}]);

View file

@ -1,3 +0,0 @@
app.controller('HomeCtrl', ['$scope', function($scope) {
}]);

View file

@ -2,20 +2,10 @@
app.config(['$stateProvider', function($stateProvider) {
$stateProvider
.state('app.home', {
url: '/home',
templateUrl: 'js/main/templates/home.tpl.html',
controller: 'HomeCtrl'
})
.state('app.about', {
url: '/about',
templateUrl: 'js/main/templates/about.tpl.html',
controller: 'AboutCtrl'
})
.state('app.contact', {
url: '/contact',
templateUrl: 'js/main/templates/contact.tpl.html',
controller: 'ContactCtrl'
.state('app.balance', {
url: '/balance',
templateUrl: 'js/main/templates/balance.tpl.html',
controller: 'BalanceCtrl'
});
}]);
}]);

View file

@ -1 +0,0 @@
<p>This is about</p>

View file

@ -0,0 +1,25 @@
<p>Balance</p>
<nvd3-pie-chart
data="balance.expenses"
x="xFunction()"
y="yFunction()"
id="ExpensesPie"
width="550"
height="350"
showLabels="true"
tooltips="true">
<svg></svg>
</nvd3-pie-chart>
<nvd3-pie-chart
data="balance.income"
x="xFunction()"
y="yFunction()"
id="incomePie"
width="550"
height="350"
showLabels="true"
tooltips="true">
<svg></svg>
</nvd3-pie-chart>

View file

@ -1 +0,0 @@
<p>This is contact</p>

View file

@ -1 +0,0 @@
<p>This is home</p>