Shows the wallet on a pop up

This commit is contained in:
Matias Pando 2014-11-04 15:24:56 -03:00
parent d8f4881582
commit 6286789f4d
4 changed files with 48 additions and 19 deletions

View File

@ -2,10 +2,8 @@
var bitcore = require('bitcore');
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $routeParams, $timeout, $location, controllerUtils) {
angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $modal, controllerUtils) {
$rootScope.title = 'Select the wallet that you will use to spend your bitcoins';
$scope.wallets = [];
var wids = _.pluck($rootScope.iden.listWallets(), 'id');
@ -13,15 +11,41 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
var w = $rootScope.iden.getWalletById(wid);
if (w && w.isReady()) {
$scope.wallets.push(w);
controllerUtils.updateBalance(w, function() {
$rootScope.$digest();
});
}
});
$scope.switchWallet = function(wid) {
//go to send page
controllerUtils.setPaymentWallet(wid);
$scope.open = function() {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
items: function() {
return $scope.wallets;
}
}
});
modalInstance.result.then(function(selectedItem) {}, function() {
$rootScope.pendingPayment = null;
});
};
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
var ModalInstanceCtrl = function($scope, $modalInstance, items, controllerUtils) {
$scope.wallets = items;
$scope.ok = function(selectedItem) {
controllerUtils.setPaymentWallet(selectedItem);
$modalInstance.close();
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
});

View File

@ -293,7 +293,6 @@ angular.module('copayApp.services')
w = w || $rootScope.wallet;
if (!w) return root.onErrorDigest();
if (!w.isReady()) return;
console.log('## Updating balance of:' + w.id)
w.balanceInfo = {};
var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo;

View File

@ -9,6 +9,14 @@
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
<div ng-include="'views/includes/version.html'"></div>
</div>
<div class="p10 box-setup bg-success m10b text-white" ng-show="pendingPayment">
<div class="left">
<i class="size-36 m10r"></i>
</div>
<div class="size-14">
Please sign in to make the payment
</div>
</div>
<div class="p10 box-setup bg-success m10b text-white" ng-show="confirmedEmail">
<div class="left">
<i class="size-36 fi-check m10r"></i>

View File

@ -1,15 +1,14 @@
<div ng-controller="PaymentIntentController" class="large-4 columns large-centered">
<!-- //TODO THIS SHOULD BE A POPUP -->
<ul class="side-nav wallets" ng-show="wallets.0"
<div ng-controller="PaymentIntentController" ng-init="open()">
<script type="text/ng-template" id="myModalContent.html">
<h3>Select a wallet to make the payment</h3>
<ul class="side-nav wallets" ng-show="wallets.0"
ng-class="{'large':wallets.length > 4, 'medium':wallets.length > 2 && wallets.length < 5}">
<li data-ng-repeat="item in wallets track by $index" class="nav-item">
<div class="col1">
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
</div>
<div class="col2">
<a class="size-12 wallet-item" ng-click="switchWallet(item.id)">
<a class="size-12 wallet-item" ng-click="ok(item)">
<div class="oh">
<div class="right size-10 type-wallet">[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>
<div class="ellipsis name-wallet">{{item.name || item.id}}</div>
@ -25,7 +24,6 @@
</div>
</li>
</ul>
<a class="close-reveal-modal" ng-click="cancel()">&#215;</a>
</script>
</div>