convert update tx history event into a function

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

View File

@ -11,13 +11,13 @@
</a>
<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>
</a>
</section>
<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>
</a>
</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.updateHistory();
}, 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) {
self.prevState = from.name || 'walletHome';
self.tab = 'walletHome';

View File

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