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
$scope.isGlidera = data.stateParams.isGlidera;
$scope.glideraAccessToken = data.stateParams.glideraAccessToken;
$scope.glideraBuy = data.stateParams.glideraBuy;
$scope.glideraSell = data.stateParams.glideraSell;
$scope.cardId = data.stateParams.cardId;
$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;
$state.transitionTo('tabs.buyandsell.glidera.confirm', {
toAmount: (amount * unitToSatoshi).toFixed(0),
glideraBuy: $scope.glideraBuy,
glideraSell: $scope.glideraSell,
isGlidera: $scope.isGlidera,
glideraAccessToken: $scope.glideraAccessToken
});
} else {

View file

@ -24,8 +24,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
// Glidera parameters
$scope.isGlidera = data.stateParams.isGlidera;
$scope.glideraAccessToken = data.stateParams.glideraAccessToken;
$scope.glideraBuy = data.stateParams.glideraBuy;
$scope.glideraSell = data.stateParams.glideraSell;
toAmount = data.stateParams.toAmount;
cachedSendMax = {};
@ -132,8 +130,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
txFormatService.formatAlternativeStr(toAmount, function(v) {
$scope.alternativeAmountStr = v;
});
if ($scope.isGlidera && $scope.glideraBuy) $scope.getBuyPrice();
if ($scope.isGlidera && $scope.glideraSell) $scope.getSellPrice();
if ($scope.isGlidera == 'buy') $scope.getBuyPrice();
if ($scope.isGlidera == 'sell') $scope.getSellPrice();
};
function resetValues() {
@ -242,7 +240,7 @@ angular.module('copayApp.controllers').controller('confirmController', 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;
$scope.showWallets = true;
};

View file

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

View file

@ -43,7 +43,7 @@
<span translate>Amount</span>
<span ng-show="isGiftCard">(Purchase Amount is limited to USD 500 per day)</span>
<div ng-show="isGlidera">
<div class="limits" ng-show="limits && glideraBuy">
<div class="limits" ng-show="limits && isGlidera == 'buy'">
<span>Daily buy limit</span>:
{{limits.dailyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}})
@ -52,7 +52,7 @@
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}})
</div>
<div class="limits" ng-show="limits && glideraSell">
<div class="limits" ng-show="limits && isGlidera == 'sell'">
<span>Daily sell limit</span>:
{{limits.dailySell|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">
<span translate ng-if="!useSendMax && !isGlidera">Sending</span>
<span translate ng-if="useSendMax">Sending maximum amount</span>
<span ng-if="isGlidera && glideraBuy">Buying</span>
<span ng-if="isGlidera && glideraSell">Selling</span>
<span ng-if="isGlidera == 'buy'">Buying</span>
<span ng-if="isGlidera == 'sell'">Selling</span>
</div>
<div class="amount-label">
<div class="amount">{{displayAmount || '...'}} <span class="unit">{{displayUnit}}</span></div>
@ -30,7 +30,8 @@
</div>
<div class="item">
<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">
<img ng-if="!cardId && !isGiftCard && !isGlidera" src="img/icon-bitcoin-small.svg">
<img ng-if="cardId" src="img/icon-card.svg" width="34">
@ -56,8 +57,8 @@
</div>
<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 && glideraBuy" translate>To</span>
<span class="label" ng-if="isGlidera && glideraSell" translate>From</span>
<span class="label" ng-if="isGlidera == 'buy'" translate>To</span>
<span class="label" ng-if="isGlidera == 'sell'" translate>From</span>
<div class="wallet">
<i class="icon big-icon-svg">
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/>
@ -79,7 +80,7 @@
{{fee || '...'}}
</span>
</div>
<div class="item" ng-show="isGlidera && glideraBuy">
<div class="item" ng-show="isGlidera == 'buy'">
<span class="label">Information</span>
<div class="glidera-explanation">
<div class="glidera-description" ng-show="buyPrice.qty">
@ -93,7 +94,7 @@
</div>
</div>
</div>
<div class="item" ng-show="isGlidera && glideraSell">
<div class="item" ng-show="isGlidera == 'sell'">
<span class="label">Information</span>
<div class="glidera-explanation">
<div class="glidera-description" ng-show="sellPrice.qty">
@ -138,10 +139,10 @@
<span ng-hide="wallet.m > 1">Payment Sent</span>
<span ng-show="wallet.m > 1">Proposal Created</span>
<div ng-show="isGlidera" class="glidera-success">
<span ng-show="glideraBuy">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="glideraSell">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 == 'buy'">A transfer has been initiated from your bank account</span>
<span ng-show="isGlidera == 'buy'">your bitcoins should arrive to your wallet in 2-4 business day</span>
<span ng-show="isGlidera == 'sell'">A transfer has been initiated to your bank account</span>
<span ng-show="isGlidera == 'sell'">should arrive in 4-6 business days</span>
</div>
</slide-to-accept-success>

View file

@ -75,14 +75,14 @@
ng-show="status && status.userCanTransact">
<a ng-show="status.userCanBuy"
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">
Buy Bitcoin
<i class="icon bp-arrow-right"></i>
</a>
<a class="item item-icon-right"
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">
Sell Bitcoin
<i class="icon bp-arrow-right"></i>