use only one route url param

This commit is contained in:
Gabriel Bazán 2016-12-05 11:54:54 -03:00
commit 6c6bab52c4
6 changed files with 22 additions and 32 deletions

View file

@ -19,8 +19,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
// Glidera parameters // Glidera parameters
$scope.isGlidera = data.stateParams.isGlidera; $scope.isGlidera = data.stateParams.isGlidera;
$scope.glideraAccessToken = data.stateParams.glideraAccessToken; $scope.glideraAccessToken = data.stateParams.glideraAccessToken;
$scope.glideraBuy = data.stateParams.glideraBuy;
$scope.glideraSell = data.stateParams.glideraSell;
$scope.cardId = data.stateParams.cardId; $scope.cardId = data.stateParams.cardId;
$scope.showMenu = $ionicHistory.backView().stateName == 'tabs.send'; $scope.showMenu = $ionicHistory.backView().stateName == 'tabs.send';
@ -343,8 +341,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount; var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount;
$state.transitionTo('tabs.buyandsell.glidera.confirm', { $state.transitionTo('tabs.buyandsell.glidera.confirm', {
toAmount: (amount * unitToSatoshi).toFixed(0), toAmount: (amount * unitToSatoshi).toFixed(0),
glideraBuy: $scope.glideraBuy, isGlidera: $scope.isGlidera,
glideraSell: $scope.glideraSell,
glideraAccessToken: $scope.glideraAccessToken glideraAccessToken: $scope.glideraAccessToken
}); });
} else { } else {

View file

@ -24,8 +24,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
// Glidera parameters // Glidera parameters
$scope.isGlidera = data.stateParams.isGlidera; $scope.isGlidera = data.stateParams.isGlidera;
$scope.glideraAccessToken = data.stateParams.glideraAccessToken; $scope.glideraAccessToken = data.stateParams.glideraAccessToken;
$scope.glideraBuy = data.stateParams.glideraBuy;
$scope.glideraSell = data.stateParams.glideraSell;
toAmount = data.stateParams.toAmount; toAmount = data.stateParams.toAmount;
cachedSendMax = {}; cachedSendMax = {};
@ -132,8 +130,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
txFormatService.formatAlternativeStr(toAmount, function(v) { txFormatService.formatAlternativeStr(toAmount, function(v) {
$scope.alternativeAmountStr = v; $scope.alternativeAmountStr = v;
}); });
if ($scope.isGlidera && $scope.glideraBuy) $scope.getBuyPrice(); if ($scope.isGlidera == 'buy') $scope.getBuyPrice();
if ($scope.isGlidera && $scope.glideraSell) $scope.getSellPrice(); if ($scope.isGlidera == 'sell') $scope.getSellPrice();
}; };
function resetValues() { function resetValues() {
@ -242,7 +240,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}); });
$scope.showWalletSelector = function() { $scope.showWalletSelector = function() {
$scope.walletSelectorTitle = $scope.glideraBuy ? 'Receive in' : $scope.glideraSell ? 'Sell From' : 'Send from'; $scope.walletSelectorTitle = $scope.isGlidera == 'buy' ? 'Receive in' : $scope.isGlidera == 'sell' ? 'Sell From' : 'Send from';
if (!$scope.useSendMax && ($scope.insufficientFunds || $scope.noMatchingWallet)) return; if (!$scope.useSendMax && ($scope.insufficientFunds || $scope.noMatchingWallet)) return;
$scope.showWallets = true; $scope.showWallets = true;
}; };

View file

@ -889,27 +889,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} }
}) })
.state('tabs.buyandsell.glidera.amount', { .state('tabs.buyandsell.glidera.amount', {
url: '/amount/:glideraBuy/:glideraSell/:glideraAccessToken', url: '/amount/:isGlidera/:glideraAccessToken',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
controller: 'amountController', controller: 'amountController',
templateUrl: 'views/amount.html' templateUrl: 'views/amount.html'
} }
},
params: {
isGlidera: true
} }
}) })
.state('tabs.buyandsell.glidera.confirm', { .state('tabs.buyandsell.glidera.confirm', {
url: '/confirm/:toAmount/:glideraBuy/:glideraSell/:glideraAccessToken', url: '/confirm/:toAmount/:isGlidera/:glideraAccessToken',
views: { views: {
'tab-home@tabs': { 'tab-home@tabs': {
controller: 'confirmController', controller: 'confirmController',
templateUrl: 'views/confirm.html' templateUrl: 'views/confirm.html'
} }
},
params: {
isGlidera: true
} }
}) })
.state('tabs.preferences.glidera', { .state('tabs.preferences.glidera', {

View file

@ -43,7 +43,7 @@
<span translate>Amount</span> <span translate>Amount</span>
<span ng-show="isGiftCard">(Purchase Amount is limited to USD 500 per day)</span> <span ng-show="isGiftCard">(Purchase Amount is limited to USD 500 per day)</span>
<div ng-show="isGlidera"> <div ng-show="isGlidera">
<div class="limits" ng-show="limits && glideraBuy"> <div class="limits" ng-show="limits && isGlidera == 'buy'">
<span>Daily buy limit</span>: <span>Daily buy limit</span>:
{{limits.dailyBuy|currency:'':2}} {{limits.currency}} {{limits.dailyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}}) (remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}})
@ -52,7 +52,7 @@
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}} {{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}}) (remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}})
</div> </div>
<div class="limits" ng-show="limits && glideraSell"> <div class="limits" ng-show="limits && isGlidera == 'sell'">
<span>Daily sell limit</span>: <span>Daily sell limit</span>:
{{limits.dailySell|currency:'':2}} {{limits.currency}} {{limits.dailySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}}) (remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}})

View file

@ -14,8 +14,8 @@
<img src="img/icon-tx-sent-outline.svg"> <img src="img/icon-tx-sent-outline.svg">
<span translate ng-if="!useSendMax && !isGlidera">Sending</span> <span translate ng-if="!useSendMax && !isGlidera">Sending</span>
<span translate ng-if="useSendMax">Sending maximum amount</span> <span translate ng-if="useSendMax">Sending maximum amount</span>
<span ng-if="isGlidera && glideraBuy">Buying</span> <span ng-if="isGlidera == 'buy'">Buying</span>
<span ng-if="isGlidera && glideraSell">Selling</span> <span ng-if="isGlidera == 'sell'">Selling</span>
</div> </div>
<div class="amount-label"> <div class="amount-label">
<div class="amount">{{displayAmount || '...'}} <span class="unit">{{displayUnit}}</span></div> <div class="amount">{{displayAmount || '...'}} <span class="unit">{{displayUnit}}</span></div>
@ -30,7 +30,8 @@
</div> </div>
<div class="item"> <div class="item">
<span class="label" ng-if="!isGlidera" translate>To</span> <span class="label" ng-if="!isGlidera" translate>To</span>
<span class="label" ng-if="isGlidera && glideraBuy">From</span> <span class="label" ng-if="isGlidera == 'buy'">From</span>
<span class="label" ng-if="isGlidera == 'sell'">To</span>
<span class="payment-proposal-to"> <span class="payment-proposal-to">
<img ng-if="!cardId && !isGiftCard && !isGlidera" src="img/icon-bitcoin-small.svg"> <img ng-if="!cardId && !isGiftCard && !isGlidera" src="img/icon-bitcoin-small.svg">
<img ng-if="cardId" src="img/icon-card.svg" width="34"> <img ng-if="cardId" src="img/icon-card.svg" width="34">
@ -56,8 +57,8 @@
</div> </div>
<a class="item item-icon-right" ng-hide="!useSendMax && (insufficientFunds || noMatchingWallet)" ng-click="showWalletSelector()"> <a class="item item-icon-right" ng-hide="!useSendMax && (insufficientFunds || noMatchingWallet)" ng-click="showWalletSelector()">
<span class="label" ng-if="!isGlidera" translate>From</span> <span class="label" ng-if="!isGlidera" translate>From</span>
<span class="label" ng-if="isGlidera && glideraBuy" translate>To</span> <span class="label" ng-if="isGlidera == 'buy'" translate>To</span>
<span class="label" ng-if="isGlidera && glideraSell" translate>From</span> <span class="label" ng-if="isGlidera == 'sell'" translate>From</span>
<div class="wallet"> <div class="wallet">
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/> <img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/>
@ -79,7 +80,7 @@
{{fee || '...'}} {{fee || '...'}}
</span> </span>
</div> </div>
<div class="item" ng-show="isGlidera && glideraBuy"> <div class="item" ng-show="isGlidera == 'buy'">
<span class="label">Information</span> <span class="label">Information</span>
<div class="glidera-explanation"> <div class="glidera-explanation">
<div class="glidera-description" ng-show="buyPrice.qty"> <div class="glidera-description" ng-show="buyPrice.qty">
@ -93,7 +94,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="item" ng-show="isGlidera && glideraSell"> <div class="item" ng-show="isGlidera == 'sell'">
<span class="label">Information</span> <span class="label">Information</span>
<div class="glidera-explanation"> <div class="glidera-explanation">
<div class="glidera-description" ng-show="sellPrice.qty"> <div class="glidera-description" ng-show="sellPrice.qty">
@ -138,10 +139,10 @@
<span ng-hide="wallet.m > 1">Payment Sent</span> <span ng-hide="wallet.m > 1">Payment Sent</span>
<span ng-show="wallet.m > 1">Proposal Created</span> <span ng-show="wallet.m > 1">Proposal Created</span>
<div ng-show="isGlidera" class="glidera-success"> <div ng-show="isGlidera" class="glidera-success">
<span ng-show="glideraBuy">A transfer has been initiated from your bank account</span> <span ng-show="isGlidera == 'buy'">A transfer has been initiated from your bank account</span>
<span ng-show="glideraBuy">your bitcoins should arrive to your wallet in 2-4 business day</span> <span ng-show="isGlidera == 'buy'">your bitcoins should arrive to your wallet in 2-4 business day</span>
<span ng-show="glideraSell">A transfer has been initiated to your bank account</span> <span ng-show="isGlidera == 'sell'">A transfer has been initiated to your bank account</span>
<span ng-show="glideraSell">should arrive in 4-6 business days</span> <span ng-show="isGlidera == 'sell'">should arrive in 4-6 business days</span>
</div> </div>
</slide-to-accept-success> </slide-to-accept-success>

View file

@ -75,14 +75,14 @@
ng-show="status && status.userCanTransact"> ng-show="status && status.userCanTransact">
<a ng-show="status.userCanBuy" <a ng-show="status.userCanBuy"
class="item item-icon-right" class="item item-icon-right"
href ui-sref="tabs.buyandsell.glidera.amount({glideraBuy: true, glideraAccessToken: token})"> href ui-sref="tabs.buyandsell.glidera.amount({isGlidera: 'buy', glideraAccessToken: token})">
<img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-buy"> <img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-buy">
Buy Bitcoin Buy Bitcoin
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>
</a> </a>
<a class="item item-icon-right" <a class="item item-icon-right"
ng-show="status.userCanSell" ng-show="status.userCanSell"
href ui-sref="tabs.buyandsell.glidera.amount({glideraSell: true, glideraAccessToken: token})"> href ui-sref="tabs.buyandsell.glidera.amount({isGlidera: 'sell', glideraAccessToken: token})">
<img src="img/sell-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-sell"> <img src="img/sell-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-sell">
Sell Bitcoin Sell Bitcoin
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>