mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #443 from yemel/feature/tx-proposal-pagination
Add pagination to transaction proposals All-tab
This commit is contained in:
commit
b4fc2122ac
|
@ -388,7 +388,7 @@
|
|||
<li> <button ng-click="show(true)" ng-disabled="loading || onlyPending" loading="Updating"> Pending </button>
|
||||
<li> <button ng-click="show()" ng-disabled="loading || !onlyPending" loading="Updating"> All </button>
|
||||
</ul>
|
||||
<div class="panel radius pending" ng-repeat="tx in txs | orderBy: 'createdTs':true">
|
||||
<div class="panel radius pending" ng-repeat="tx in txs | paged">
|
||||
<div class="txheader row m10">
|
||||
<div class="large-8 medium-8 small-12 columns">
|
||||
<div class="row" ng-repeat="out in tx.outs">
|
||||
|
@ -477,6 +477,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<pagination ng-show="!onlyPending" total-items="txs.length" items-per-page="txpItemsPerPage" page="txpCurrentPage" on-select-page="show()" class="pagination-small"></pagination>
|
||||
</div>
|
||||
<div class="large-12 columns">
|
||||
<h4>Last transactions</h4>
|
||||
|
|
|
@ -8,9 +8,17 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
$scope.onlyPending = true;
|
||||
$scope.lastShowed = false;
|
||||
|
||||
$scope.txpCurrentPage = 1;
|
||||
$scope.txpItemsPerPage = 4;
|
||||
|
||||
$scope.update = function () {
|
||||
$scope.loading = false;
|
||||
controllerUtils.updateTxs({onlyPending:$scope.onlyPending});
|
||||
var from = ($scope.txpCurrentPage-1) * $scope.txpItemsPerPage;
|
||||
var opts = {
|
||||
onlyPending: $scope.onlyPending,
|
||||
skip: !$scope.onlyPending ? [from, from + $scope.txpItemsPerPage] : null
|
||||
};
|
||||
controllerUtils.updateTxs(opts);
|
||||
$rootScope.$digest();
|
||||
};
|
||||
|
||||
|
|
|
@ -19,4 +19,9 @@ angular.module('copay.filters', [])
|
|||
return { addr: key, value: dic[key] };
|
||||
});
|
||||
};
|
||||
});
|
||||
})
|
||||
.filter('paged', function() {
|
||||
return function(elements) {
|
||||
return elements.filter(Boolean);
|
||||
};
|
||||
});
|
||||
|
|
|
@ -132,11 +132,15 @@ angular.module('copay.controllerUtils')
|
|||
console.log('## updating tx proposals', opts); //TODO
|
||||
var myCopayerId = w.getMyCopayerId();
|
||||
var pendingForUs = 0;
|
||||
var inT = w.getTxProposals();
|
||||
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
||||
var txs = [];
|
||||
|
||||
console.log('[START LOOP]'); //TODO
|
||||
inT.forEach(function(i){
|
||||
inT.forEach(function(i, index){
|
||||
if (opts.skip && (index < opts.skip[0] || index >= opts.skip[1])) {
|
||||
return txs.push(null);
|
||||
}
|
||||
|
||||
if (myCopayerId != i.creator && !i.finallyRejected && !i.sentTs && !i.rejectedByUs && !i.signedByUs) {
|
||||
pendingForUs++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue