Merge pull request #3904 from JDonadio/feat/show-more-02

Feat/show more
This commit is contained in:
Gustavo Maximiliano Cortez 2016-02-23 10:47:41 -03:00
commit 94433c23e1
2 changed files with 17 additions and 16 deletions

View file

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

View file

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