bwc
This commit is contained in:
parent
04fb7ba032
commit
320de62f13
348 changed files with 7745 additions and 30874 deletions
52
src/js/controllers/sidebar.js
Normal file
52
src/js/controllers/sidebar.js
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('sidebarController',
|
||||
function($rootScope, $timeout, lodash, profileService, configService, go) {
|
||||
var self = this;
|
||||
self.walletSelection = false;
|
||||
|
||||
// wallet list change
|
||||
$rootScope.$on('Local/WalletListUpdated', function(event) {
|
||||
self.walletSelection = false;
|
||||
self.setWallets();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ColorUpdated', function(event) {
|
||||
self.setWallets();
|
||||
});
|
||||
|
||||
self.signout = function() {
|
||||
profileService.signout();
|
||||
};
|
||||
|
||||
self.switchWallet = function(wid) {
|
||||
self.walletSelection = false;
|
||||
profileService.setAndStoreFocus(wid, function() {});
|
||||
go.walletHome();
|
||||
};
|
||||
|
||||
self.toggleWalletSelection = function() {
|
||||
self.walletSelection = !self.walletSelection;
|
||||
if (!self.walletSelection) return;
|
||||
self.setWallets();
|
||||
};
|
||||
|
||||
self.setWallets = function() {
|
||||
if (!profileService.profile) return;
|
||||
var config = configService.getSync();
|
||||
config.colorFor = config.colorFor || {};
|
||||
var ret = lodash.map(profileService.profile.credentials, function(c) {
|
||||
return {
|
||||
m: c.m,
|
||||
n: c.n,
|
||||
name: c.walletName,
|
||||
id: c.walletId,
|
||||
color: config.colorFor[c.walletId] || '#1ABC9C',
|
||||
};
|
||||
});
|
||||
self.wallets = lodash.sortBy(ret, 'walletName');
|
||||
};
|
||||
|
||||
self.setWallets();
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue