From f3c97288900ab474f1524fb0289f09f6239097d4 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 9 Feb 2016 15:10:25 -0300 Subject: [PATCH 1/2] rename variables/event --- src/js/controllers/index.js | 12 +++++++++++- src/js/controllers/topbar.js | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 928c830e9..fe11cace7 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -926,7 +926,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r if (walletId == profileService.focusedClient.credentials.walletId) { self.completeHistory = newHistory; 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() { @@ -935,6 +935,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); }); } + self.showAllHistory = function() { self.historyShowShowAll = false; 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) { self.prevState = from.name || 'walletHome'; self.tab = 'walletHome'; diff --git a/src/js/controllers/topbar.js b/src/js/controllers/topbar.js index b3f58ad0e..c25102f46 100644 --- a/src/js/controllers/topbar.js +++ b/src/js/controllers/topbar.js @@ -1,12 +1,14 @@ 'use strict'; -angular.module('copayApp.controllers').controller('topbarController', function(go) { +angular.module('copayApp.controllers').controller('topbarController', function(go, $rootScope) { this.goHome = function() { + $rootScope.$emit('Local/UpdateTxHistory'); go.walletHome(); }; this.goPreferences = function() { + $rootScope.$emit('Local/UpdateTxHistory'); go.preferences(); }; From eb3680ba6d2d28a11a891887bc3e0c928bf610a9 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 9 Feb 2016 17:09:23 -0300 Subject: [PATCH 2/2] convert update tx history event into a function --- public/views/includes/topbar.html | 8 ++++---- src/js/controllers/index.js | 15 ++++++--------- src/js/controllers/topbar.js | 4 +--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/public/views/includes/topbar.html b/public/views/includes/topbar.html index bbda0916c..1a7f28d40 100644 --- a/public/views/includes/topbar.html +++ b/public/views/includes/topbar.html @@ -1,5 +1,5 @@ -