Show contact if exist on tx list

This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-19 09:57:55 -03:00
commit dc21ac2a8c
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 11 additions and 5 deletions

View file

@ -113,10 +113,13 @@ angular.module('copayApp.directives')
}
}
})
.directive('contact', ['addressbookService', 'lodash',
function(addressbookService, lodash) {
.directive('contact', ['addressbookService', 'lodash', 'gettextCatalog',
function(addressbookService, lodash, gettextCatalog) {
return {
restrict: 'E',
scope: {
label: '='
},
link: function(scope, element, attrs) {
var addr = attrs.address;
addressbookService.get(addr, function(err, ab) {
@ -124,7 +127,11 @@ angular.module('copayApp.directives')
var name = lodash.isObject(ab) ? ab.name : ab;
element.append(name);
} else {
element.append(addr);
if (scope.label && scope.label == 'Sent') {
element.append(gettextCatalog.getString('Sent'));
} else {
element.append(addr);
}
}
});
}

View file

@ -161,8 +161,7 @@
<span 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 && wallet.addressbook[btx.addressTo]">{{wallet.addressbook[btx.addressTo]}}</div>
<div ng-if="!btx.message && !btx.note.body && !wallet.addressbook[btx.addressTo]" translate> Sent</div>
<contact ng-if="!btx.message && !btx.note.body" class="ellipsis" address="{{btx.addressTo}}" label="'Sent'"></contact>
</span>
</div>