change variable name and fix more error

This commit is contained in:
Gabriel Bazán 2016-02-23 15:50:46 -03:00
commit 1d097de0f4
2 changed files with 15 additions and 12 deletions

View file

@ -217,7 +217,7 @@
<a ng-click="index.cancelSearch()" translate>Cancel</a> <a ng-click="index.cancelSearch()" translate>Cancel</a>
</div> </div>
</div> </div>
<div ng-repeat="btx in index.txHistoryToList track by btx.txid" <div ng-repeat="btx in index.txHistorySearchResults track by btx.txid"
ng-click="home.openTxModal(btx)" ng-click="home.openTxModal(btx)"
class="row collapse last-transactions-content"> class="row collapse last-transactions-content">
<div class="large-6 medium-6 small-6 columns size-14"> <div class="large-6 medium-6 small-6 columns size-14">
@ -288,7 +288,7 @@
<a class="text-gray size-12" <a class="text-gray size-12"
ng-show="index.historyShowMore && index.isSearching" ng-show="index.historyShowMore && index.isSearching"
ng-click="index.showMore()"> ng-click="index.showMore()">
{{index.result.length - index.txHistoryToList.length}} <span translate>more</span> {{index.result.length - index.txHistorySearchResults.length}} <span translate>more</span>
<i class="icon-arrow-down4"></i> <i class="icon-arrow-down4"></i>
</a> </a>
</div> </div>

View file

@ -910,21 +910,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.showMore = function() { self.showMore = function() {
$timeout(function() { $timeout(function() {
if (self.isSearching) { if (self.isSearching) {
self.txHistoryToList = self.result.slice(0, self.nextTxHistory); self.txHistorySearchResults = self.result.slice(0, self.nextTxHistory);
$log.debug('Total txs: ', self.txHistorySearchResults.length + '/' + self.result.length);
if (self.txHistorySearchResults.length >= self.result.length)
self.historyShowMore = false;
} else { } else {
self.txHistory = self.completeHistory.slice(0, self.nextTxHistory); self.txHistory = self.completeHistory.slice(0, self.nextTxHistory);
self.txHistoryToList = self.txHistory; self.txHistorySearchResults = self.txHistory;
$log.debug('Total txs: ', self.txHistorySearchResults.length + '/' + self.completeHistory.length);
if (self.txHistorySearchResults.length >= self.completeHistory.length)
self.historyShowMore = false;
} }
$log.debug('Total txs: ', self.txHistoryToList.length + '/' + self.result.length);
self.nextTxHistory += self.historyShowMoreLimit; self.nextTxHistory += self.historyShowMoreLimit;
if (self.txHistoryToList.length >= self.result.length)
self.historyShowMore = false;
}, 100); }, 100);
}; };
self.startSearch = function(){ self.startSearch = function(){
self.isSearching = true; self.isSearching = true;
self.txHistoryToList = []; self.txHistorySearchResults = [];
self.result = []; self.result = [];
self.historyShowMore = false; self.historyShowMore = false;
self.nextTxHistory = self.historyShowMoreLimit; self.nextTxHistory = self.historyShowMoreLimit;
@ -973,7 +976,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
return self.result; return self.result;
}; };
self.txHistoryToList = filter(self.search).slice(0, self.historyShowLimit); self.txHistorySearchResults = filter(self.search).slice(0, self.historyShowLimit);
if (isCordova) if (isCordova)
window.plugins.toast.showShortBottom(gettextCatalog.getString('Matches: ' + self.result.length)); window.plugins.toast.showShortBottom(gettextCatalog.getString('Matches: ' + self.result.length));
@ -1037,7 +1040,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.isSearching = false; self.isSearching = false;
self.nextTxHistory = self.historyShowMoreLimit; self.nextTxHistory = self.historyShowMoreLimit;
self.txHistory = self.completeHistory.slice(0, self.historyShowLimit); self.txHistory = self.completeHistory.slice(0, self.historyShowLimit);
self.txHistoryToList = self.txHistory; self.txHistorySearchResults = self.txHistory;
self.historyShowMore = self.completeHistory.length > self.historyShowLimit; self.historyShowMore = self.completeHistory.length > self.historyShowLimit;
}; };
@ -1233,7 +1236,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('Local/ClearHistory', function(event) { $rootScope.$on('Local/ClearHistory', function(event) {
$log.debug('The wallet transaction history has been deleted'); $log.debug('The wallet transaction history has been deleted');
self.txHistory = self.completeHistory = self.txHistoryToList = []; self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
self.debounceUpdateHistory(); self.debounceUpdateHistory();
}); });
@ -1374,7 +1377,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$log.debug('Backup done stored'); $log.debug('Backup done stored');
addressService.expireAddress(walletId, function(err) { addressService.expireAddress(walletId, function(err) {
$timeout(function() { $timeout(function() {
self.txHistory = self.completeHistory = self.txHistoryToList = []; self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
storageService.removeTxHistory(walletId, function() { storageService.removeTxHistory(walletId, function() {
self.startScan(walletId); self.startScan(walletId);
}); });