convert update tx history event into a function

This commit is contained in:
Javier 2016-02-09 17:09:23 -03:00
commit eb3680ba6d
3 changed files with 11 additions and 16 deletions

View file

@ -11,13 +11,13 @@
</a> </a>
<a ng-show="closeToHome" class="p10 " <a ng-show="closeToHome" class="p10 "
ng-click="topbar.goHome(); closeToHome = null"> ng-click="topbar.goHome(); index.setCompactTxHistory(); closeToHome = null">
<span class="text-close">{{'Close'|translate}}</span> <span class="text-close">{{'Close'|translate}}</span>
</a> </a>
</section> </section>
<section class="right-small" ng-show="showPreferences && !index.noFocusedWallet"> <section class="right-small" ng-show="showPreferences && !index.noFocusedWallet">
<a class="p10" ng-click="topbar.goPreferences()"> <a class="p10" ng-click="topbar.goPreferences(); index.setCompactTxHistory()">
<i class="fi-widget size-24"></i> <i class="fi-widget size-24"></i>
</a> </a>
</section> </section>

View file

@ -996,6 +996,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
}; };
self.setCompactTxHistory = function() {
self.txHistory = self.completeHistory.slice(0, self.historyShowLimit);
if (self.completeHistory.length > self.historyShowLimit)
self.historyShowShowAll = true;
};
self.debounceUpdateHistory = lodash.debounce(function() { self.debounceUpdateHistory = lodash.debounce(function() {
self.updateHistory(); self.updateHistory();
}, 1000); }, 1000);
@ -1178,15 +1184,6 @@ 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,14 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('topbarController', function(go, $rootScope) { angular.module('copayApp.controllers').controller('topbarController', function(go) {
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();
}; };