mirror of https://github.com/BTCPrivate/copay.git
Shows the wallet on a pop up
This commit is contained in:
parent
d8f4881582
commit
6286789f4d
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
var bitcore = require('bitcore');
|
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 = [];
|
$scope.wallets = [];
|
||||||
|
|
||||||
var wids = _.pluck($rootScope.iden.listWallets(), 'id');
|
var wids = _.pluck($rootScope.iden.listWallets(), 'id');
|
||||||
|
@ -13,15 +11,41 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun
|
||||||
var w = $rootScope.iden.getWalletById(wid);
|
var w = $rootScope.iden.getWalletById(wid);
|
||||||
if (w && w.isReady()) {
|
if (w && w.isReady()) {
|
||||||
$scope.wallets.push(w);
|
$scope.wallets.push(w);
|
||||||
controllerUtils.updateBalance(w, function() {
|
|
||||||
$rootScope.$digest();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.switchWallet = function(wid) {
|
$scope.open = function() {
|
||||||
//go to send page
|
var modalInstance = $modal.open({
|
||||||
controllerUtils.setPaymentWallet(wid);
|
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');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -293,7 +293,6 @@ angular.module('copayApp.services')
|
||||||
w = w || $rootScope.wallet;
|
w = w || $rootScope.wallet;
|
||||||
if (!w) return root.onErrorDigest();
|
if (!w) return root.onErrorDigest();
|
||||||
if (!w.isReady()) return;
|
if (!w.isReady()) return;
|
||||||
console.log('## Updating balance of:' + w.id)
|
|
||||||
|
|
||||||
w.balanceInfo = {};
|
w.balanceInfo = {};
|
||||||
var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo;
|
var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo;
|
||||||
|
|
|
@ -9,6 +9,14 @@
|
||||||
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
|
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
|
||||||
<div ng-include="'views/includes/version.html'"></div>
|
<div ng-include="'views/includes/version.html'"></div>
|
||||||
</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="p10 box-setup bg-success m10b text-white" ng-show="confirmedEmail">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<i class="size-36 fi-check m10r"></i>
|
<i class="size-36 fi-check m10r"></i>
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
<div ng-controller="PaymentIntentController" class="large-4 columns large-centered">
|
<div ng-controller="PaymentIntentController" ng-init="open()">
|
||||||
|
<script type="text/ng-template" id="myModalContent.html">
|
||||||
|
<h3>Select a wallet to make the payment</h3>
|
||||||
<!-- //TODO THIS SHOULD BE A POPUP -->
|
<ul class="side-nav wallets" ng-show="wallets.0"
|
||||||
<ul class="side-nav wallets" ng-show="wallets.0"
|
|
||||||
ng-class="{'large':wallets.length > 4, 'medium':wallets.length > 2 && wallets.length < 5}">
|
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">
|
<li data-ng-repeat="item in wallets track by $index" class="nav-item">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
|
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2">
|
<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="oh">
|
||||||
<div class="right size-10 type-wallet">[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>
|
<div class="right size-10 type-wallet">[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>
|
||||||
<div class="ellipsis name-wallet">{{item.name || item.id}}</div>
|
<div class="ellipsis name-wallet">{{item.name || item.id}}</div>
|
||||||
|
@ -25,7 +24,6 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue