Fix modals and choose focused wallet in sell page
This commit is contained in:
parent
25721a3387
commit
3e8a3976eb
4 changed files with 68 additions and 6 deletions
40
public/views/modals/glidera-wallets.html
Normal file
40
public/views/modals/glidera-wallets.html
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<nav class="tab-bar">
|
||||
<section class="left-small">
|
||||
<a ng-click="cancel()" class="p10">
|
||||
<span class="text-close" translate>Close</span>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<section class="middle tab-bar-section">
|
||||
<h1 class="title ellipsis">
|
||||
<span ng-show="type == 'BUY'">Choose your destination wallet</span>
|
||||
<span ng-show="type == 'SELL'">Choose your source wallet</span>
|
||||
</h1>
|
||||
</section>
|
||||
</nav>
|
||||
|
||||
<div class="modal-content">
|
||||
<div ng-show="type == 'SELL'">
|
||||
<h4 class="title m0 oh">
|
||||
<div class="left">
|
||||
<i class="fi-info size-18 m10r"></i>
|
||||
</div>
|
||||
<div class="size-10 m5t">
|
||||
Notice: only 1-1 (single signature) wallets can be used for sell bitcoin
|
||||
</div>
|
||||
</h4>
|
||||
</div>
|
||||
<ul class="no-bullet">
|
||||
<li class="line-b" ng-repeat="w in wallets">
|
||||
<a ng-click="selectWallet(w.id, w.name)" class="db oh">
|
||||
<div class="avatar-wallet"
|
||||
ng-style="{'background-color':w.color}">{{(w.name || w.id) | limitTo: 1}}</div>
|
||||
<div class="ellipsis name-wallet text-bold">{{w.name || w.id}}</div>
|
||||
<div class="size-12">{{w.m}} of {{w.n}}
|
||||
<span ng-show="w.network=='testnet'">[Testnet]</span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
</div>
|
||||
|
|
@ -51,12 +51,12 @@
|
|||
ng-submit="sell.get2faCode(index.glideraToken)" novalidate>
|
||||
|
||||
<div ng-if="index.glideraToken"
|
||||
ng-init="otherWallets = sell.otherWallets(index.glideraTestnet)"
|
||||
ng-click="openWalletsModal(otherWallets)">
|
||||
ng-init="sell.init(index.glideraTestnet)"
|
||||
ng-click="openWalletsModal(sell.otherWallets)">
|
||||
<label>Wallet</label>
|
||||
<div class="input">
|
||||
<input type="text" id="address" name="address" ng-disabled="sell.selectedWalletId"
|
||||
ng-attr-placeholder="{{'Choose your destination wallet'}}"
|
||||
ng-attr-placeholder="{{'Choose your source wallet'}}"
|
||||
ng-model="sell.selectedWalletName" required>
|
||||
<a class="postfix size-12 m0 text-gray">
|
||||
<i class="icon-wallet size-18"></i>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
self.selectedWalletName = null;
|
||||
self.selectedWalletAddr = null;
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
$scope.type = 'BUY';
|
||||
$scope.wallets = wallets;
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
|
|
@ -49,7 +50,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
};
|
||||
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'views/modals/wallets.html',
|
||||
templateUrl: 'views/modals/glidera-wallets.html',
|
||||
windowClass: animationService.modalAnimated.slideUp,
|
||||
controller: ModalInstanceCtrl,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,18 +14,39 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
this.currentFeeLevel = config.wallet.settings.feeLevel || 'normal';
|
||||
var fc;
|
||||
|
||||
this.otherWallets = function(testnet) {
|
||||
var otherWallets = function(testnet) {
|
||||
var network = testnet ? 'testnet' : 'livenet';
|
||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||
return w.network == network && w.m == 1;
|
||||
});
|
||||
};
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.otherWallets = otherWallets(testnet);
|
||||
// Choose focused wallet
|
||||
try {
|
||||
var currentWalletId = profileService.focusedClient.credentials.walletId;
|
||||
lodash.find(self.otherWallets, function(w) {
|
||||
if (w.id == currentWalletId) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = w.id;
|
||||
self.selectedWalletName = w.name;
|
||||
fc = profileService.getClient(w.id);
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
};
|
||||
|
||||
$scope.openWalletsModal = function(wallets) {
|
||||
self.error = null;
|
||||
self.selectedWalletId = null;
|
||||
self.selectedWalletName = null;
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
$scope.type = 'SELL';
|
||||
$scope.wallets = wallets;
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
|
|
@ -45,7 +66,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
};
|
||||
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'views/modals/wallets.html',
|
||||
templateUrl: 'views/modals/glidera-wallets.html',
|
||||
windowClass: animationService.modalAnimated.slideUp,
|
||||
controller: ModalInstanceCtrl,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue