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>
|
</span>
|
||||||
</a>
|
</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 all</span>
|
||||||
<span ng-if="showAll">Show less</span>
|
<span ng-if="showAll">Show less</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -17,41 +17,16 @@ angular.module('copayApp.filters', [])
|
||||||
})
|
})
|
||||||
.filter('limitAddress', function() {
|
.filter('limitAddress', function() {
|
||||||
return function(elements, showAll) {
|
return function(elements, showAll) {
|
||||||
var addrs = [];
|
if (elements.length <= 1 || showAll) {
|
||||||
if (elements.length > 0) {
|
return elements;
|
||||||
if (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]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return addrs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
})
|
// Show last 3 non-change addresses plus those with balance
|
||||||
.filter('withoutFunds', function() {
|
var addrs = elements.filter(function(e, i) {
|
||||||
return function(elements) {
|
return (!e.isChange && i < 3) || (e.balance && e.balance > 0);
|
||||||
var len = 0;
|
});
|
||||||
for (var i=0;i<elements.length;i++) {
|
|
||||||
if (!elements[i].balance || elements[i].balance == 0) {
|
return addrs;
|
||||||
len++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue