handle 0 wallets

This commit is contained in:
Ivan Socolsky 2014-10-15 17:18:30 -03:00 committed by Matias Alejo Garcia
commit 43c0eb9cb6
5 changed files with 23 additions and 23 deletions

View file

@ -65,7 +65,7 @@
class="sidebar"
ng-if="$root.iden"></div>
<section ng-class="{'main' : $root.iden && $root.iden.listWallets().length>0}" ng-view></section>
<section ng-class="{'main' : $root.iden && $root.iden.listWallets().length>=0}" ng-view></section>
<a class="exit-off-canvas"></a>

View file

@ -3,11 +3,11 @@
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, notification, controllerUtils, pluginManager) {
controllerUtils.redirIfLogged();
$scope.retreiving =true;
$scope.retreiving = true;
copay.Identity.anyProfile({
pluginManager: pluginManager,
}, function(any) {
$scope.retreiving =false;
$scope.retreiving = false;
if (!any)
$location.path('/createProfile');
});
@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
if (err && !iden) {
console.log('Error:' + err)
controllerUtils.onErrorDigest(
$scope, (err.toString()||'').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
$scope, (err.toString() || '').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
} else {
controllerUtils.bindProfile($scope, iden, firstWallet);
}

View file

@ -190,9 +190,8 @@ Identity.open = function(email, password, opts, cb) {
iden.profile = profile;
var wids = _.pluck(iden.listWallets(), 'id');
if (!wids || !wids.length)
return new Error('Could not open any wallet from profile');
return cb(new Error('Could not open any wallet from profile'), iden);
// Open All wallets from profile
//This could be optional, or opts.onlyOpen = wid

View file

@ -217,10 +217,13 @@ angular.module('copayApp.services')
};
root.bindProfile = function($scope, iden, w) {
root.setupGlobalVariables(iden);
root.rebindWallets($scope, iden);
if (w) {
root.setFocusedWallet(w);
} else {
$location.path('/manage');
}
};

View file

@ -10,7 +10,6 @@
<ul class="side-nav">
<li data-ng-repeat="item in $root.iden.listWallets() track by $index" class="nav-item db p20h">
<a ng-click="switchWallet(item.id)" ng-if="item.id != $root.wallet.id "> <i class="size-21 m20r fi-bitcoin-circle"></i> {{item.name || item.id}}</a>
<div ng-if="item.id == $root.wallet.id ">
@ -56,7 +55,7 @@
</li>
</ul>
</div>
</li>
<li class="nav-item" ui-route="{{create}}">
<a href="#!/manage" class="db p20h" title="Create"><i class="size-21 m20r fi-plus"></i> {{'Manage Wallets' | translate }} </a>
@ -71,4 +70,3 @@
</div>
</div>