From ca3e9005a7c0551f3d30b557bae5d0a4092c3bad Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 10 Nov 2014 16:41:07 -0300 Subject: [PATCH] Manage wallets --- css/src/main.css | 8 ++++++ css/src/mobile.css | 11 --------- js/controllers/manage.js | 21 ++++++++++++++++ js/services/controllerUtils.js | 6 +++-- views/manage.html | 45 +++++++++++++++++++++++++++++++++- 5 files changed, 77 insertions(+), 14 deletions(-) diff --git a/css/src/main.css b/css/src/main.css index ca693ca11..a0957a77f 100644 --- a/css/src/main.css +++ b/css/src/main.css @@ -909,6 +909,14 @@ label small.has-error { font-size: 11px; } +table tr.active { + background: #CBECE6; +} + +table tr.deleting { + background: #FCD5D5; +} + /* SECONDARY */ input[type='submit'] diff --git a/css/src/mobile.css b/css/src/mobile.css index 400c76249..e7e42fe1f 100644 --- a/css/src/mobile.css +++ b/css/src/mobile.css @@ -6,17 +6,6 @@ @media (max-width: 1024px) { - .line-dashed-setup-v, - .line-dashed-v, - .line-dashed-h { - border: none; - } - - .status { - left: 0; - top: 40px; - } - .logo-setup { margin: 20px 0; padding: 2rem 0; diff --git a/js/controllers/manage.js b/js/controllers/manage.js index 97c53a0bc..347d07900 100644 --- a/js/controllers/manage.js +++ b/js/controllers/manage.js @@ -12,4 +12,25 @@ angular.module('copayApp.controllers').controller('ManageController', function($ $scope.backupPlainText = backupService.profileEncrypted($rootScope.iden); $scope.hideViewBackup = true; }; + + $scope.getWallets = function() { + $scope.wallets = []; + var wids = _.pluck($rootScope.iden.listWallets(), 'id'); + _.each(wids, function(wid) { + var w = $rootScope.iden.getWalletById(wid); + $scope.wallets.push(w); + controllerUtils.updateBalance(w, function() { + $rootScope.$digest(); + }, true); + }); + }; + + $scope.deleteWallet = function(w) { + if (!w) return; + $scope.loading = w.id; + controllerUtils.deleteWallet($scope, w, function() { + $scope.loading = false; + $scope.getWallets(); + }); + }; }); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 02e4179d1..a871347c8 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -359,10 +359,12 @@ angular.module('copayApp.services') $rootScope.pendingTxCount = res.pendingForUs; }; - root.deleteWallet = function($scope, w) { + root.deleteWallet = function($scope, w, cb) { w = w || $rootScope.wallet; + var name = w.getName(); $rootScope.iden.deleteWallet(w.id, function() { - notification.info('Wallet deleted', $filter('translate')('Wallet deleted')); + notification.info(name + ' deleted', $filter('translate')('Wallet deleted')); + if (cb) return cb(); $rootScope.wallet = null; var lastFocused = $rootScope.iden.getLastFocusedWallet(); root.bindProfile($scope, $rootScope.iden, lastFocused); diff --git a/views/manage.html b/views/manage.html index 95e4cf5ef..58c9e8f99 100644 --- a/views/manage.html +++ b/views/manage.html @@ -24,7 +24,50 @@ -
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
NameTypeStatusBalanceActions
{{item.name || item.id }}{{item.requiredCopayers}} of {{item.totalCopayers}}{{isReady ? 'Complete' : 'Waiting for copayers...'}} + - + + {{item.balanceInfo.totalBalance || 0 |noFractionNumber}} {{item.settings.unitName}} + + + Delete + + Active +
+
+
+ +