rename variables/event

This commit is contained in:
Javier 2016-02-09 15:10:25 -03:00
commit f3c9728890
2 changed files with 14 additions and 2 deletions

View file

@ -926,7 +926,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (walletId == profileService.focusedClient.credentials.walletId) { if (walletId == profileService.focusedClient.credentials.walletId) {
self.completeHistory = newHistory; self.completeHistory = newHistory;
self.txHistory = newHistory.slice(0, self.historyShowLimit); self.txHistory = newHistory.slice(0, self.historyShowLimit);
self.historyShowShowAll = newHistory.length >= self.historyShowLimit; self.historyShowShowAll = newHistory.length > self.historyShowLimit;
} }
return storageService.setTxHistory(JSON.stringify(newHistory), walletId, function() { return storageService.setTxHistory(JSON.stringify(newHistory), walletId, function() {
@ -935,6 +935,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
}); });
} }
self.showAllHistory = function() { self.showAllHistory = function() {
self.historyShowShowAll = false; self.historyShowShowAll = false;
self.historyRendering = true; self.historyRendering = true;
@ -1177,6 +1178,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
}; };
$rootScope.$on('Local/UpdateTxHistory', function(event) {
$timeout(function () {
self.txHistory = self.completeHistory.slice(0, self.historyShowLimit);
if (self.completeHistory.length > self.historyShowLimit)
self.historyShowShowAll = true;
}, 10);
});
$rootScope.$on('$stateChangeSuccess', function(ev, to, toParams, from, fromParams) { $rootScope.$on('$stateChangeSuccess', function(ev, to, toParams, from, fromParams) {
self.prevState = from.name || 'walletHome'; self.prevState = from.name || 'walletHome';
self.tab = 'walletHome'; self.tab = 'walletHome';

View file

@ -1,12 +1,14 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('topbarController', function(go) { angular.module('copayApp.controllers').controller('topbarController', function(go, $rootScope) {
this.goHome = function() { this.goHome = function() {
$rootScope.$emit('Local/UpdateTxHistory');
go.walletHome(); go.walletHome();
}; };
this.goPreferences = function() { this.goPreferences = function() {
$rootScope.$emit('Local/UpdateTxHistory');
go.preferences(); go.preferences();
}; };