Pattern processing, pt. 2

This commit is contained in:
2016-07-19 16:21:06 +02:00
parent 9a55fc9d0d
commit cc996b593f
5 changed files with 52 additions and 4 deletions
@@ -28,7 +28,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
// .antMatchers("/console/**").permitAll() // H2 console for the dev database
.anyRequest().authenticated();
http.httpBasic(); // XXX mit HTTP Basic Auth funktioniert der Logout nicht richtig
// http.httpBasic(); // XXX mit HTTP Basic Auth funktioniert der Logout nicht richtig
http.formLogin();
http.csrf().disable(); // XXX später wieder aktivieren
+1 -1
View File
@@ -1,4 +1,4 @@
INSERT INTO User (id, name, username) VALUES (1, 'Adam', 'adam@mail.com'), (2, 'Betty', 'betty@mail.com'), (3, 'Curt', 'curt@mail.com');
INSERT INTO User (id, name, username) VALUES (1, 'Adam', 'adam'), (2, 'Betty', 'betty'), (3, 'Curt', 'curt');
INSERT INTO Account (id, name, owner_id) VALUES (1, 'Gemeinschaftskonto', 1), (2, 'Konto Adam', 1);
INSERT INTO Category (id, name, account_id, position) VALUES
+1 -1
View File
@@ -34,7 +34,7 @@
<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">
+42 -1
View File
@@ -359,7 +359,7 @@ transactionControllers.controller('OutstandingsModalCtrl', [ '$scope', '$uibModa
}
} ]);
transactionControllers.controller('ImportCtrl', [ '$scope', '$location', 'ImportService', function($scope, $location, ImportService) {
transactionControllers.controller('ImportCtrl', [ '$scope', '$resource', '$location', 'ImportService', function($scope, $resource, $location, ImportService) {
$scope.importCSV = function () {
ImportService.saveData($scope.csvInput);
@@ -373,4 +373,45 @@ transactionControllers.controller('ImportCtrl', [ '$scope', '$location', 'Import
console.log($scope.csv);
}
// COPIED CODE from TransactionListCtrl.initList, needs to be moved into a Service
$scope.initPage = function () {
console.log('aloha');
var userinfo = $resource('/user').get();
userinfo.$promise.then(function(data) {
$scope.userid = userinfo.name;
userinfo = $resource('/users/search/findByUsername', { username: $scope.userid }).get();
userinfo.$promise.then(function(data) {
$scope.userinfo = userinfo;
});
var accountInfo = $resource('/accounts/search/findByUserName', { username: $scope.userid }).get();
accountInfo.$promise.then(function(data) {
console.log(accountInfo._embedded.accounts);
$scope.accounts = accountInfo._embedded.accounts;
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) {
$scope.categories = categories._embedded.categories;
if ($scope.importForm) {
$scope.importForm.$setPristine();
$scope.importForm.$setUntouched();
}
});
});
});
}
$scope.initPage();
} ]);
@@ -1,5 +1,12 @@
<div class="container">
<div class="row">
<div ng-show="accounts.length > 1" style="margin: 2ex; text-align: center; font-size: 120%;">
<select
ng-model='account'
ng-change='initPage()'
ng-options="account.name for account in accounts track by account.id"></select>
</div>
<form name="importForm" ng-submit="importCSV()" style="text-align: center;">
<textarea ng-model='csvInput' name="csvText" cols="140" rows="20"></textarea>