From 9667f324f1db66f7cdfa7ce5b6c9b38c92f41d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 20 Jan 2015 16:29:19 +0100 Subject: [PATCH] added ability to create accounts from profile page --- .../features/profile/partials/profile.html | 35 +++++++++++++++++-- src/app/features/profile/profileCtrl.js | 12 ++++--- src/css/less/bootswatch.dark.less | 2 +- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/app/features/profile/partials/profile.html b/src/app/features/profile/partials/profile.html index 76e3fc64ef3..2f5df6146ed 100644 --- a/src/app/features/profile/partials/profile.html +++ b/src/app/features/profile/partials/profile.html @@ -58,8 +58,8 @@
- - Active account + + Your accounts

@@ -69,7 +69,9 @@ Name: {{ac.name}} Role: {{ac.role}} - currently using this account + + active now + @@ -78,7 +80,34 @@ +
+
+ +
+
+ + Add account +
+
+
+ +
+
+
    +
  • + Account name +
  • +
  • + +
  • +
  • + +
  • +
+
+
+
diff --git a/src/app/features/profile/profileCtrl.js b/src/app/features/profile/profileCtrl.js index 3683fdc5621..0a2ea70efe7 100644 --- a/src/app/features/profile/profileCtrl.js +++ b/src/app/features/profile/profileCtrl.js @@ -8,6 +8,8 @@ function (angular) { module.controller('ProfileCtrl', function($scope, $http, backendSrv) { + $scope.newAccount = {name: ''}; + $scope.init = function() { $scope.getUser(); $scope.getUserAccounts(); @@ -26,11 +28,7 @@ function (angular) { }; $scope.setUsingAccount = function(account) { - backendSrv.request({ - method: 'POST', - url: '/api/user/using/' + account.accountId, - desc: 'Change active account', - }).then($scope.getUserAccounts); + backendSrv.post('/api/user/using/' + account.accountId).then($scope.getUserAccounts); }; $scope.update = function() { @@ -39,6 +37,10 @@ function (angular) { backendSrv.post('/api/user/', $scope.user); }; + $scope.createAccount = function() { + backendSrv.put('/api/account/', $scope.newAccount).then($scope.getUserAccounts); + }; + $scope.init(); }); diff --git a/src/css/less/bootswatch.dark.less b/src/css/less/bootswatch.dark.less index 98b91b4b8d8..f3d83683f51 100644 --- a/src/css/less/bootswatch.dark.less +++ b/src/css/less/bootswatch.dark.less @@ -486,7 +486,7 @@ legend, label { } .label { - color: @grayLighter; + color: @white; } .badge {