simplify receive and wallet home tab

This commit is contained in:
Matias Alejo Garcia 2014-12-04 10:36:58 -03:00
commit 3edec5e597
7 changed files with 159 additions and 122 deletions

View file

@ -4,13 +4,12 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
$scope.init = function() {
$rootScope.title = 'Home';
$scope.addr = _.last($rootScope.wallet.getReceiveAddresses());
// This is necesarry, since wallet can change in homeWallet, without running init() again.
$rootScope.$watch('wallet', function() {
if ($rootScope.wallet && $rootScope.wallet.isComplete()) {
$scope.addr = _.last($rootScope.wallet.getReceiveAddresses());
}
});
// $rootScope.$watch('wallet', function() {
// if ($rootScope.wallet && $rootScope.wallet.isComplete()) {
// $scope.addr = _.last($rootScope.wallet.getReceiveAddresses());
// }
// });
};
});

View file

@ -2,9 +2,6 @@
angular.module('copayApp.controllers').controller('ReceiveController',
function($scope, $rootScope, $timeout, $modal) {
$rootScope.title = 'Receive';
$scope.loading = false;
$scope.showAll = false;
$scope.newAddr = function() {
var w = $rootScope.wallet;
@ -16,6 +13,25 @@ angular.module('copayApp.controllers').controller('ReceiveController',
}, 1);
};
$scope.init = function() {
$rootScope.title = 'Receive';
$scope.showAll = false;
var w = $rootScope.wallet;
var lastAddr = _.first(w.getAddressesOrderer());
var balance = w.balanceInfo.balanceByAddr;
if (balance[lastAddr]>0)
$scope.loading = true;
while (balance && balance[lastAddr] > 0) {
$scope.newAddr();
lastAddr = w.generateAddress(null);
};
$scope.loading = false;
$scope.addr = lastAddr;
};
$scope.openAddressModal = function(address) {
var ModalInstanceCtrl = function($scope, $modalInstance, address) {
$scope.address = address;
@ -43,6 +59,7 @@ angular.module('copayApp.controllers').controller('ReceiveController',
};
$scope.setAddressList = function() {
if ($scope.showAll) {
var w = $rootScope.wallet;
var balance = w.balanceInfo.balanceByAddr;
@ -64,6 +81,9 @@ angular.module('copayApp.controllers').controller('ReceiveController',
});
$scope.addresses = list;
}
} else {
$scope.addresses = [];
}
};
}
);

View file

@ -30,29 +30,23 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row ">
<!-- Address-->
<div class="large-6 columns">
<div class="panel oh">
<h2 class="line-b" translate>Quick receive</h2>
<div class="text-center">
<qrcode size="220" data="bitcoin:{{addr}}"></qrcode>
<div class="m10t">
<h4 class="size-12">{{addr}} </h4>
<span ng-if="$root.updatingBalance">
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
<div class="large-12 columns line-t m10t">
<div class="right size-10">
<span ng-if="!$root.wallet.isShared()">Personal Wallet</span>
<span ng-if="$root.wallet.isShared()">
Multisignature wallet [{{$root.wallet.requiredCopayers}} of {{$root.wallet.totalCopayers}} ]
</span>
<span ng-if="$root.wallet.isTestnet()"> in TESTNET</span>
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-if="$root.wallet.isShared()">
<!-- List of copayers -->
<div class="large-6 columns">
<div class="large-12 columns">
<div class="panel oh">
<h2 class="line-b" translate>Copayers</h2>
<div ng-include="'views/includes/copayer.html'"></div>

View file

@ -41,12 +41,12 @@
<div class="large-6 medium-12 small-12 columns" ng-show="!tx.sentTs">
<div ng-show="tx.signedBy[myId]">
<button class="secondary left m10r tiny m0 radius" ng-disabled="true"> <i class="fi-check icon-sign check"></i>
<span translate>I signed</span>
<span translate>Signed by me</span>
</button>
</div>
<div ng-show="tx.rejectedBy[myId]">
<button class="warning left m10r tiny m0 radius" ng-disabled="true"> <i class="fi-x icon-sign x"></i>
<span translate>I rejected</span>
<span translate>Rejected by me</span>
</button>
</div>
<div ng-show="!tx.signedBy[myId] && !tx.rejectedBy[myId]">
@ -79,7 +79,7 @@
<strong translate>Fee</strong>: {{tx.fee}} {{$root.wallet.settings.unitName}}
</div>
<div class="m5t">
<strong translate>Proposal ID</strong>: {{tx.ntxid}}
<strong translate>Proposal ID</strong>: <span:e >{{tx.ntxid}}
</div>
</div>
</div>

View file

@ -1,6 +1,5 @@
<div ng-controller="VersionController">
<small>v{{version}}</small>
<small>#{{commitHash}}</small>
<small ng-if="$root.wallet.isTestnet()">[TESTNET]</small>
</div>

View file

@ -1,9 +1,31 @@
<div class="addresses" ng-controller="ReceiveController" ng-init="setAddressList()">
<div class="addresses" ng-controller="ReceiveController" ng-init="init()">
<div class="row">
<div class="large-12 medium-12 small-12 columns">
<h1 class="hide-for-large-up">{{$root.title}}</h1>
<div ng-show="!addresses[0]">
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</div>
</div>
<div class="row">
<!-- Address-->
<div class="large-12 columns" ng-if="addr">
<div class="panel oh">
<div class="row">
<h2 class="line-b" translate>My Bitcoin address:</h2>
<div class="text-center" ng-if="!loading">
<qrcode size="220" data="bitcoin:{{addr}}"></qrcode>
<div class="m10t">
<h4 class="size-12">{{addr}}</h4>
</div>
</div>
<div class="text-center" ng-if="loading">
Generating new address...
</div>
</div>
<div class="row">
<div class="large-12 columns line-t m10t size-12">
Share this with anyone to have them send you payments. To protect your privacy, new addresses are generated automatically once you use them.
</div>
</div>
</div>
</div>
</div>
@ -47,21 +69,24 @@
</div>
</div>
</div>
</div> <!-- end of panel mobile -->
</div>
<!-- end of panel mobile -->
</div>
</div>
</div>
<div class="large-12 columns">
<div class="m20b text-right">
<a class="size-12" ng-click="toggleShowAll()" ng-show="addrLength > 3">
<span translate ng-if="!showAll">Show all</span>
<span translate ng-if="showAll">Show less</span>
<a class="button primary text-center right" ng-click="newAddr()" ng-disabled="loading">
Generate new address
</a>
<a class="button primary text-center" ng-click="toggleShowAll()" ng-disabled="loading">
<span translate ng-if="showAll">Hide them</span>
</a>
</div>
<a class="button tiny primary text-center" ng-click="newAddr()" ng-disabled="loading">
<i class="fi-plus m5r"></i> Add
<div class="large-12 columns" ng-if="!showAll">
<div class="m20b">
<a class="button primary text-center" ng-click="toggleShowAll()" ng-disabled="loading">
<span translate>Show all my addresses</span>
</a>
</div>
</div>
</div>
</div>

View file

@ -1,4 +1,11 @@
<div class="send" ng-controller="SendController" ng-init="init()">
<div class="row">
<div class="large-12 medium-12 small-12 columns">
<div ng-show="txps.length != 0" class="line-dashed-h m20b"></div>
<h1 class="hide-for-large-up">{{$root.title}}</h1>
</div>
</div>
<div class="row" ng-show="txps.length != 0">
<div class="large-12 columns">
<h2 translate>Pending Transactions Proposals</h2>
@ -8,13 +15,6 @@
</div>
</div>
<div class="row">
<div class="large-12 medium-12 small-12 columns">
<div ng-show="txps.length != 0" class="line-dashed-h m20b"></div>
<h1 class="hide-for-large-up">{{$root.title}}</h1>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<h2 ng-show="txps.length != 0" translate>Create Transaction Proposal</h2>