WIP: reorder main menu. Renamed home for addresses. Fix header titles
This commit is contained in:
parent
d7333fb981
commit
5267c2ad48
6 changed files with 18 additions and 19 deletions
39
js/controllers/addresses.js
Normal file
39
js/controllers/addresses.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.addresses').controller('AddressesController',
|
||||
function($scope, $rootScope, $location, Socket, controllerUtils) {
|
||||
$scope.title = 'Home';
|
||||
$scope.oneAtATime = true;
|
||||
$scope.addrBalance = {};
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
|
||||
var _updateBalance = function () {
|
||||
w.getBalance(function (balance, balanceByAddr) {
|
||||
if (balanceByAddr && Object.keys(balanceByAddr).length) {
|
||||
$scope.balanceByAddr = balanceByAddr;
|
||||
$scope.addrs = Object.keys(balanceByAddr);
|
||||
$scope.selectedAddr = $scope.addrs[0];
|
||||
$scope.$digest();
|
||||
}
|
||||
});
|
||||
var socket = Socket($scope);
|
||||
controllerUtils.handleTransactionByAddress($scope, _updateBalance);
|
||||
};
|
||||
|
||||
$scope.newAddr = function() {
|
||||
var a = w.generateAddress().toString();
|
||||
_updateBalance();
|
||||
};
|
||||
|
||||
$scope.selectAddr = function(addr) {
|
||||
$scope.selectedAddr = addr;
|
||||
};
|
||||
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
_updateBalance();
|
||||
w.on('refresh',_updateBalance);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue