show more

This commit is contained in:
Javier 2016-02-22 17:33:41 -03:00
commit 147de5e697
2 changed files with 17 additions and 16 deletions

View file

@ -258,9 +258,10 @@
<div class="m20t text-center">
<a class="text-gray size-12"
ng-show="index.historyShowShowAll"
ng-click="index.showAllHistory()">
<span translate>Show all</span>
ng-show="index.historyShowMore"
ng-click="index.showMore()">
{{index.completeHistory.length - index.txHistory.length}} <span translate>more</span>
<i class="icon-arrow-down4"></i>
</a>
</div>
</div>

View file

@ -14,6 +14,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
ret.usePushNotifications = ret.isCordova && !isMobile.Windows();
ret.onGoingProcess = {};
ret.historyShowLimit = 10;
ret.historyShowMoreLimit = 100;
ret.prevState = 'walletHome';
ret.menu = [{
@ -892,15 +893,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
}
self.showAllHistory = function() {
self.historyShowShowAll = false;
self.historyRendering = true;
self.showMore = function() {
$timeout(function() {
$rootScope.$apply();
$timeout(function() {
self.historyRendering = false;
self.txHistory = self.completeHistory;
}, 100);
self.txHistory = self.completeHistory.slice(0, self.nextTxHistory);
$log.debug('Total txs: ', self.txHistory.length + '/' + self.completeHistory.length);
self.nextTxHistory += self.historyShowMoreLimit;
if (self.txHistory.length >= self.completeHistory.length)
self.historyShowMore = false;
}, 100);
};
@ -956,8 +955,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
};
self.setCompactTxHistory = function() {
self.nextTxHistory = self.historyShowMoreLimit;
self.txHistory = self.completeHistory.slice(0, self.historyShowLimit);
self.historyShowShowAll = self.completeHistory.length > self.historyShowLimit;
self.historyShowMore = self.completeHistory.length > self.historyShowLimit;
};
self.debounceUpdateHistory = lodash.debounce(function() {