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,15 +3,15 @@
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');
});
$scope.openProfile = function(form) {
if (form && form.$invalid) {
@ -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);
root.setFocusedWallet(w);
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 ">
@ -23,25 +22,25 @@
<div class="founds size-14 m10v">
{{'Balance'|translate}}
<span ng-if="$root.updatingBalance">
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</span>
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</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>
</span>
<div class="m10t" ng-show="lockedBalance">
{{'Locked'|translate}} &nbsp;
<span ng-if="$root.updatingBalance">
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</span>
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</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> &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 class="wfooter">
<span ng-if="$root.wallet.isShared()">
{{$root.wallet.requiredCopayers}} <span translate>of</span> {{$root.wallet.totalCopayers}} wallet
<span ng-if="!$root.wallet.isReady()">
<span class="creation"> in creation </span>
</span>
{{$root.wallet.requiredCopayers}} <span translate>of</span> {{$root.wallet.totalCopayers}} wallet
<span ng-if="!$root.wallet.isReady()">
<span class="creation"> in creation </span>
</span>
</span>
<span ng-if="$root.wallet.isTestnet()" [TESTNET]</span>
</div>
@ -50,13 +49,13 @@
<a href="#!/{{item.link}}" ng-click="toggleCollapse()" class="db p20h">
<i class="size-21 m20r {{item.icon}}"></i> {{item.title|translate}}
<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>
</a>
</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>