mirror of https://github.com/BTCPrivate/copay.git
Change default address list
This commit is contained in:
parent
78493f9d91
commit
38ac18458b
|
@ -390,7 +390,7 @@
|
|||
</span>
|
||||
</a>
|
||||
|
||||
<a class="secondary radius" ng-click="showAll=!showAll" ng-show="(addresses|withoutFunds) > 1">
|
||||
<a class="secondary radius" ng-click="showAll=!showAll" ng-show="addresses.length != (addresses|limitAddress).length">
|
||||
<span ng-if="!showAll">Show all</span>
|
||||
<span ng-if="showAll">Show less</span>
|
||||
</a>
|
||||
|
|
|
@ -17,41 +17,16 @@ angular.module('copayApp.filters', [])
|
|||
})
|
||||
.filter('limitAddress', function() {
|
||||
return function(elements, showAll) {
|
||||
var addrs = [];
|
||||
if (elements.length > 0) {
|
||||
if (showAll) {
|
||||
if (elements.length <= 1 || showAll) {
|
||||
return elements;
|
||||
}
|
||||
if (elements.length == 1) {
|
||||
return elements;
|
||||
}
|
||||
else {
|
||||
for (var i=0;i<elements.length;i++) {
|
||||
if (!elements[i].isChange && (!elements[i].balance || elements[i].balance == 0)) {
|
||||
addrs.push(elements[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i=0;i<elements.length;i++) {
|
||||
if (elements[i].balance && elements[i].balance > 0) {
|
||||
addrs.push(elements[i]);
|
||||
}
|
||||
}
|
||||
// Show last 3 non-change addresses plus those with balance
|
||||
var addrs = elements.filter(function(e, i) {
|
||||
return (!e.isChange && i < 3) || (e.balance && e.balance > 0);
|
||||
});
|
||||
|
||||
return addrs;
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('withoutFunds', function() {
|
||||
return function(elements) {
|
||||
var len = 0;
|
||||
for (var i=0;i<elements.length;i++) {
|
||||
if (!elements[i].balance || elements[i].balance == 0) {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
};
|
||||
})
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue