account selection via GET parameter

This commit is contained in:
2016-07-18 23:30:53 +02:00
parent 6c3398be79
commit 610e77f7b9
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.tilman</groupId>
<artifactId>next-transactions</artifactId>
<version>1.1.4</version>
<version>1.1.6</version>
<parent>
<groupId>org.springframework.boot</groupId>
+2 -1
View File
@@ -33,8 +33,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- meta name="apple-mobile-web-app-capable" content="yes" -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="icon" href="/apple-touch-icon.png">
</head>
<body>
+9 -2
View File
@@ -16,7 +16,7 @@ function numberToAmount(number) {
return amount;
}
transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location', '$resource', '$q', '$uibModal', '$log', 'Transaction', function($scope, $location, $resource, $q, $uibModal, $log, Transaction) {
transactionControllers.controller('TransactionListCtrl', [ '$scope', '$routeParams', '$resource', '$q', '$uibModal', '$log', 'Transaction', function($scope, $routeParams, $resource, $q, $uibModal, $log, Transaction) {
function refreshExpenses() {
var accountUsers = $resource($scope.account._links.users.href).get();
@@ -134,8 +134,15 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
var accountInfo = $resource('/accounts/search/findByUserName', { username: $scope.userid }).get();
accountInfo.$promise.then(function(data) {
$scope.accounts = accountInfo._embedded.accounts;
if ($scope.account == undefined)
if ($scope.account == undefined) {
$scope.account = $scope.accounts[0];
if ($routeParams.account != undefined) {
for (i = 0; i < $scope.accounts.length; i++) {
if ($scope.accounts[i].name == $routeParams.account)
$scope.account = $scope.accounts[i];
}
}
}
var categories = $resource('/categories/search/listForAccount', { accountId: $scope.account.id }).get();
categories.$promise.then(function(data) {