mirror of
https://github.com/gwenhael-le-moine/ledgerrb.git
synced 2025-01-26 07:58:10 +01:00
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) {
|
||||
$scope.items = ['Home', 'About', 'Contact'];
|
||||
});
|
||||
app.controller( 'NavbarCtrl',
|
||||
function( $scope ) {
|
||||
$scope.items = [ 'Balance' ];
|
||||
} );
|
||||
|
|
|
@ -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'
|
||||
});
|
||||
|
||||
}]);
|
||||
}]);
|
||||
|
|
|
@ -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) {
|
||||
|
||||
$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'
|
||||
});
|
||||
|
||||
}]);
|
||||
}]);
|
||||
|
|
|
@ -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