Add pagination to transaction proposals All-tab

This commit is contained in:
Yemel Jardi 2014-05-20 11:14:52 -07:00
parent 08f0e548bd
commit c51731dc69
3 changed files with 15 additions and 2 deletions

View File

@ -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 | orderBy: 'createdTs':true | paged:txpCurrentPage:txpItemsPerPage:onlyPending">
<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" class="pagination-small"></pagination>
</div>
<div class="large-12 columns">
<h4>Last transactions</h4>

View File

@ -8,6 +8,9 @@ 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});

View File

@ -19,4 +19,13 @@ angular.module('copay.filters', [])
return { addr: key, value: dic[key] };
});
};
});
})
.filter('paged', function() {
return function(elements, page, pageSize, disable) {
if (disable) return elements;
var from = (page - 1) * pageSize;
var to = from + pageSize;
return elements.slice(from, to);;
};
});