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

View file

@ -190,9 +190,8 @@ Identity.open = function(email, password, opts, cb) {
iden.profile = profile; iden.profile = profile;
var wids = _.pluck(iden.listWallets(), 'id'); var wids = _.pluck(iden.listWallets(), 'id');
if (!wids || !wids.length) 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 // Open All wallets from profile
//This could be optional, or opts.onlyOpen = wid //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.bindProfile = function($scope, iden, w) {
root.setupGlobalVariables(iden); root.setupGlobalVariables(iden);
root.rebindWallets($scope, iden); root.rebindWallets($scope, iden);
root.setFocusedWallet(w); if (w) {
root.setFocusedWallet(w);
} else {
$location.path('/manage');
}
}; };

View file

@ -10,7 +10,6 @@
<ul class="side-nav"> <ul class="side-nav">
<li data-ng-repeat="item in $root.iden.listWallets() track by $index" class="nav-item db p20h"> <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> <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 "> <div ng-if="item.id == $root.wallet.id ">
@ -23,25 +22,25 @@
<div class="founds size-14 m10v"> <div class="founds size-14 m10v">
{{'Balance'|translate}} {{'Balance'|translate}}
<span ng-if="$root.updatingBalance"> <span ng-if="$root.updatingBalance">
<i class="fi-bitcoin-circle icon-rotate spinner"></i> <i class="fi-bitcoin-circle icon-rotate spinner"></i>
</span> </span>
<span ng-if="$root.wallet && !$root.updatingBalance" class="has-tip size-16" data-options="disable_for_touch:true" tooltip-popup-delay='500' tooltip="{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}" tooltip-trigger="mouseenter" tooltip-placement="bottom">{{totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}} <span ng-if="$root.wallet && !$root.updatingBalance" class="has-tip size-16" data-options="disable_for_touch:true" tooltip-popup-delay='500' tooltip="{{totalBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}" tooltip-trigger="mouseenter" tooltip-placement="bottom">{{totalBalance || 0 |noFractionNumber}} {{$root.wallet.settings.unitName}}
</span> </span>
<div class="m10t" ng-show="lockedBalance"> <div class="m10t" ng-show="lockedBalance">
{{'Locked'|translate}} &nbsp; {{'Locked'|translate}} &nbsp;
<span ng-if="$root.updatingBalance"> <span ng-if="$root.updatingBalance">
<i class="fi-bitcoin-circle icon-rotate spinner"></i> <i class="fi-bitcoin-circle icon-rotate spinner"></i>
</span> </span>
<span ng-if="$root.wallet && !$root.updatingBalance" class="has-tip" data-options="disable_for_touch:true" tooltip-popup-delay='500' tooltip="{{lockedBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}" tooltip-trigger="mouseenter" tooltip-placement="bottom">{{lockedBalance || 0|noFractionNumber}} {{$root.wallet.settings.unitName}} <span ng-if="$root.wallet && !$root.updatingBalance" class="has-tip" data-options="disable_for_touch:true" tooltip-popup-delay='500' tooltip="{{lockedBalanceAlternative |noFractionNumber:2}} {{alternativeIsoCode}}" tooltip-trigger="mouseenter" tooltip-placement="bottom">{{lockedBalance || 0|noFractionNumber}} {{$root.wallet.settings.unitName}}
</span> &nbsp;<i class="fi-info medium" tooltip="{{'Balance locked in pending transaction proposals'|translate}}" tooltip-placement="bottom"></i> </span> &nbsp;<i class="fi-info medium" tooltip="{{'Balance locked in pending transaction proposals'|translate}}" tooltip-placement="bottom"></i>
</div> </div>
</div> </div>
<div class="wfooter"> <div class="wfooter">
<span ng-if="$root.wallet.isShared()"> <span ng-if="$root.wallet.isShared()">
{{$root.wallet.requiredCopayers}} <span translate>of</span> {{$root.wallet.totalCopayers}} wallet {{$root.wallet.requiredCopayers}} <span translate>of</span> {{$root.wallet.totalCopayers}} wallet
<span ng-if="!$root.wallet.isReady()"> <span ng-if="!$root.wallet.isReady()">
<span class="creation"> in creation </span> <span class="creation"> in creation </span>
</span> </span>
</span> </span>
<span ng-if="$root.wallet.isTestnet()" [TESTNET]</span> <span ng-if="$root.wallet.isTestnet()" [TESTNET]</span>
</div> </div>
@ -50,13 +49,13 @@
<a href="#!/{{item.link}}" ng-click="toggleCollapse()" class="db p20h"> <a href="#!/{{item.link}}" ng-click="toggleCollapse()" class="db p20h">
<i class="size-21 m20r {{item.icon}}"></i> {{item.title|translate}} <i class="size-21 m20r {{item.icon}}"></i> {{item.title|translate}}
<span class="right"> <span class="right">
<span class="label alert" ng-if="item.link=='send' && $root.pendingTxCount > 0">{{$root.pendingTxCount}}</span> <span class="label alert" ng-if="item.link=='send' && $root.pendingTxCount > 0">{{$root.pendingTxCount}}</span>
</span> </span>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
</li>
<li class="nav-item" ui-route="{{create}}"> <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> <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>
</div> </div>