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

@ -179,7 +179,7 @@
<div translate>Updating transaction history. Please stand by.</div> <div translate>Updating transaction history. Please stand by.</div>
</div> </div>
</div> </div>
</div> </div>
<div ng-if="index.txHistory[0] && index.updatingTxHistory && index.newTx" class="row collapse last-transactions-content animated fadeInDown"> <div ng-if="index.txHistory[0] && index.updatingTxHistory && index.newTx" class="row collapse last-transactions-content animated fadeInDown">
<div class="large-6 medium-6 small-6 columns size-14"> <div class="large-6 medium-6 small-6 columns size-14">
@ -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>
@ -358,12 +359,12 @@
<div class="pr p25b"> <div class="pr p25b">
<h4 class="title m0"> <h4 class="title m0">
<available-balance></available-balance> <available-balance></available-balance>
<span <span
ng-show="home.lockedCurrentFeePerKb || home.blockUx || home.lockAmount" ng-show="home.lockedCurrentFeePerKb || home.blockUx || home.lockAmount"
class="text-gray" translate>Send All</span> class="text-gray" translate>Send All</span>
<a <a
ng-show="index.availableBalanceSat > 0 && !home.lockedCurrentFeePerKb && !home.blockUx && !home.lockAmount" ng-show="index.availableBalanceSat > 0 && !home.lockedCurrentFeePerKb && !home.blockUx && !home.lockAmount"
ng-click="home.sendAll(index.totalBytesToSendMax, index.availableBalanceSat)" ng-click="home.sendAll(index.totalBytesToSendMax, index.availableBalanceSat)"
translate> Send All translate> Send All
</a> </a>
<div ng-show="!home.paymentExpired && home._paypro"> <div ng-show="!home.paymentExpired && home._paypro">

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() {