From 9428ea55d5a50a4f9a19933e9c152d44800aa404 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Tue, 20 May 2014 19:40:02 -0300 Subject: [PATCH] UX: just update address balance that received fund. Changed rootscope for scope to control address page. Fixes: not alert when address change receive fund --- index.html | 67 ++++++++++++++++++++++++---------- js/controllers/addresses.js | 26 +++++++++++-- js/controllers/header.js | 12 +++++- js/services/controllerUtils.js | 1 - 4 files changed, 80 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index 96b0c03b2..58d3e20b8 100644 --- a/index.html +++ b/index.html @@ -32,15 +32,21 @@
Balance: - ... - {{totalBalance || 0}} -
+ + + + {{totalBalance || 0}} + +
Available to Spend: - ... - {{availableBalance || 0}} - + + + + {{availableBalance || 0}} + +
@@ -317,37 +323,58 @@
-
+
-
- +
+

- ... - {{balanceByAddr[selectedAddr] || 0}} - + + + + + {{balanceByAddr[selectedAddr.address] || 0}} + + + + + {{selectedAddr.balance || 0}} + +

-
+

Create a New Address

-
+
diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index a17a44aa2..c34931dd2 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -11,14 +11,32 @@ angular.module('copay.addresses').controller('AddressesController', $timeout(function() { controllerUtils.setSocketHandlers(); controllerUtils.updateAddressList(); - $rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString(); $scope.loading = false; - $rootScope.$digest(); },1); }); }; - $scope.selectAddr = function (addr) { - return addr === $rootScope.selectedAddr ? 'selected' : ''; + $scope.selectAddress = function (addr) { + $scope.selectedAddr = addr; }; + + $rootScope.$watch('addrInfos', function(addrInfos) { + $scope.addressList(addrInfos); + }); + + $scope.addressList = function (addrInfos) { + $scope.addresses = []; + if (addrInfos) { + for(var i=0;i