mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #635 from cmgustavo/bug/wallet-details-tx-list
Preload the address book on wallet-details
This commit is contained in:
commit
c689d4eb13
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService) {
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService) {
|
||||
|
||||
var HISTORY_SHOW_LIMIT = 10;
|
||||
var currentTxHistoryPage = 0;
|
||||
|
@ -184,6 +184,11 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
||||
$scope.requiresMultipleSignatures = $scope.wallet.credentials.m > 1;
|
||||
|
||||
addressbookService.list(function(err, ab) {
|
||||
if (err) $log.error(err);
|
||||
$scope.addressbook = ab || {};
|
||||
});
|
||||
|
||||
$scope.updateAll();
|
||||
|
||||
listeners = [
|
||||
|
|
|
@ -113,13 +113,10 @@ angular.module('copayApp.directives')
|
|||
}
|
||||
}
|
||||
})
|
||||
.directive('contact', ['addressbookService', 'lodash', 'gettextCatalog',
|
||||
function(addressbookService, lodash, gettextCatalog) {
|
||||
.directive('contact', ['addressbookService', 'lodash',
|
||||
function(addressbookService, lodash) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
label: '='
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
var addr = attrs.address;
|
||||
addressbookService.get(addr, function(err, ab) {
|
||||
|
@ -127,11 +124,7 @@ angular.module('copayApp.directives')
|
|||
var name = lodash.isObject(ab) ? ab.name : ab;
|
||||
element.append(name);
|
||||
} else {
|
||||
if (scope.label && scope.label == 'Sent') {
|
||||
element.append(gettextCatalog.getString('Sent'));
|
||||
} else {
|
||||
element.append(addr);
|
||||
}
|
||||
element.append(addr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -150,26 +150,23 @@
|
|||
<img class="wallet-details__tx-icon" src="img/icon-tx-moved.svg" alt="sync" width="40" ng-if="btx.action == 'moved'">
|
||||
|
||||
<div class="wallet-details__tx-title">
|
||||
<div ng-if="btx.action == 'received'">
|
||||
<span class="ellipsis">
|
||||
<div ng-if="btx.note.body">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" translate> Received</div>
|
||||
</span>
|
||||
<div ng-show="btx.action == 'received'" class="ellipsis">
|
||||
<div ng-if="btx.note.body">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" translate> Received</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="btx.action == 'sent'">
|
||||
<span class="ellipsis">
|
||||
<div ng-if="btx.message">{{btx.message}}</div>
|
||||
<div ng-if="!btx.message && btx.note.body">{{btx.note.body}}</div>
|
||||
<contact ng-if="!btx.message && !btx.note.body" class="ellipsis" address="{{btx.addressTo}}" label="'Sent'"></contact>
|
||||
</span>
|
||||
<div ng-show="btx.action == 'sent'" class="ellipsis">
|
||||
<div ng-if="btx.message">{{btx.message}}</div>
|
||||
<div ng-if="!btx.message && btx.note.body">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.message && !btx.note.body && addressbook[btx.addressTo]">
|
||||
{{addressbook[btx.addressTo].name}}
|
||||
</div>
|
||||
<div ng-if="!btx.message && !btx.note.body && !addressbook[btx.addressTo]" translate>Sent</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="btx.action == 'moved'">
|
||||
<span class="ellipsis">
|
||||
<div ng-if="btx.note.body">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" translate>Moved</div>
|
||||
</span>
|
||||
<div ng-show="btx.action == 'moved'" class="ellipsis">
|
||||
<div ng-if="btx.note.body">{{btx.note.body}}</div>
|
||||
<div ng-if="!btx.note.body" translate>Moved</div>
|
||||
</div>
|
||||
<span class="label tu warning radius" ng-if="btx.action == 'invalid'" translate>Invalid</span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue