From 610e77f7b944aab253c744b8534ad6df5271111e Mon Sep 17 00:00:00 2001 From: Tilman Liero Date: Mon, 18 Jul 2016 23:30:53 +0200 Subject: [PATCH] account selection via GET parameter --- pom.xml | 2 +- src/main/resources/static/index.html | 3 ++- src/main/resources/static/js/controllers.js | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index a45c6ed..b6ecbdd 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.tilman next-transactions - 1.1.4 + 1.1.6 org.springframework.boot diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index a68f1a7..e04f734 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -33,8 +33,9 @@ - + + diff --git a/src/main/resources/static/js/controllers.js b/src/main/resources/static/js/controllers.js index 9b72375..403d718 100644 --- a/src/main/resources/static/js/controllers.js +++ b/src/main/resources/static/js/controllers.js @@ -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) {