remove default stubs
This commit is contained in:
parent
7bc04b3ddf
commit
af352d2533
11 changed files with 69 additions and 39 deletions
|
@ -1,3 +1,4 @@
|
||||||
app.controller('NavbarCtrl', function($scope) {
|
app.controller( 'NavbarCtrl',
|
||||||
$scope.items = ['Home', 'About', 'Contact'];
|
function( $scope ) {
|
||||||
});
|
$scope.items = [ 'Balance' ];
|
||||||
|
} );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Application Level State
|
// Application Level State
|
||||||
app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
|
app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
|
||||||
|
|
||||||
$urlRouterProvider.when('', '/home');
|
$urlRouterProvider.when('', '/balance');
|
||||||
|
|
||||||
|
|
||||||
$stateProvider
|
$stateProvider
|
||||||
|
@ -9,13 +9,13 @@ app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $ur
|
||||||
url: '',
|
url: '',
|
||||||
controller: 'AppCtrl',
|
controller: 'AppCtrl',
|
||||||
views: {
|
views: {
|
||||||
'navbar': {
|
'navbar': {
|
||||||
templateUrl: 'js/core/templates/navbar.tpl.html',
|
templateUrl: 'js/core/templates/navbar.tpl.html',
|
||||||
controller: 'NavbarCtrl'
|
controller: 'NavbarCtrl'
|
||||||
},
|
},
|
||||||
'main': {
|
'main': {
|
||||||
templateUrl: 'js/core/templates/main.tpl.html'
|
templateUrl: 'js/core/templates/main.tpl.html'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('404', {
|
.state('404', {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
app.controller('AboutCtrl', ['$scope', function($scope) {
|
|
||||||
|
|
||||||
}]);
|
|
26
public/app/js/main/controllers/BalanceCtrl.js
Normal file
26
public/app/js/main/controllers/BalanceCtrl.js
Normal 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;
|
||||||
|
} );
|
||||||
|
}]);
|
|
@ -1,3 +0,0 @@
|
||||||
app.controller('ContactCtrl', ['$scope', function($scope) {
|
|
||||||
|
|
||||||
}]);
|
|
|
@ -1,3 +0,0 @@
|
||||||
app.controller('HomeCtrl', ['$scope', function($scope) {
|
|
||||||
|
|
||||||
}]);
|
|
|
@ -2,20 +2,10 @@
|
||||||
app.config(['$stateProvider', function($stateProvider) {
|
app.config(['$stateProvider', function($stateProvider) {
|
||||||
|
|
||||||
$stateProvider
|
$stateProvider
|
||||||
.state('app.home', {
|
.state('app.balance', {
|
||||||
url: '/home',
|
url: '/balance',
|
||||||
templateUrl: 'js/main/templates/home.tpl.html',
|
templateUrl: 'js/main/templates/balance.tpl.html',
|
||||||
controller: 'HomeCtrl'
|
controller: 'BalanceCtrl'
|
||||||
})
|
|
||||||
.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'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -1 +0,0 @@
|
||||||
<p>This is about</p>
|
|
25
public/app/js/main/templates/balance.tpl.html
Normal file
25
public/app/js/main/templates/balance.tpl.html
Normal 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>
|
|
@ -1 +0,0 @@
|
||||||
<p>This is contact</p>
|
|
|
@ -1 +0,0 @@
|
||||||
<p>This is home</p>
|
|
Loading…
Add table
Reference in a new issue