From f6f9e5d7fc6f151cd9bd27db6dca3bc7a726d454 Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 25 Jul 2016 11:23:05 -0300 Subject: [PATCH] fix UI --- public/views/modals/inputAmount.html | 8 ++++---- public/views/walletHome.html | 15 ++++----------- src/js/controllers/modals/inputAmount.js | 20 +++++++++++++------- src/js/controllers/walletHome.js | 7 +++++++ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/public/views/modals/inputAmount.html b/public/views/modals/inputAmount.html index 66d28bc43..e9192df9c 100644 --- a/public/views/modals/inputAmount.html +++ b/public/views/modals/inputAmount.html @@ -6,7 +6,7 @@

Enter amount

-
+ @@ -16,9 +16,9 @@
{{amount}}
-
{{amountResult}} {{alternativeIsoCode}}
+
{{globalResult}} {{amountResult}} {{alternativeIsoCode}}
${{alternativeAmount}}
-
{{alternativeResult}} {{unitName}}
+
{{globalResult}} {{alternativeResult}} {{unitName}}
@@ -55,7 +55,7 @@
- -
@@ -432,8 +425,8 @@
- - + +
{{home.unitName}} {{home.alternativeIsoCode}} diff --git a/src/js/controllers/modals/inputAmount.js b/src/js/controllers/modals/inputAmount.js index 23a66cf5e..e0833a10b 100644 --- a/src/js/controllers/modals/inputAmount.js +++ b/src/js/controllers/modals/inputAmount.js @@ -37,15 +37,19 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct amount = format($scope.alternativeAmount); $scope.amountResult = isOperator(lodash.last(amount)) ? evaluate(amount.slice(0, -1)) : evaluate(amount); } + $scope.globalResult = null; }; $scope.pushDigit = function(digit) { var amount = $scope.showAlternativeAmount ? $scope.alternativeAmount.toString() : $scope.amount.toString(); - if (amount.length >= 10) return; - if (amount == '0' && digit == 0) return; - var val = amount ? amount + digit : digit; - processAmount(val); + if (amount.length >= 20) return; + if (amount == '0') { + if (digit == 0) return; + processAmount(digit); + return; + } + processAmount(amount + digit); }; $scope.pushOperator = function(operator) { @@ -93,6 +97,7 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct function resetAmount() { $scope.amount = $scope.alternativeAmount = $scope.alternativeResult = $scope.amountResult = 0; + $scope.globalResult = null; }; function processAmount(val) { @@ -116,6 +121,7 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct if (lodash.isNumber(result)) { $scope.amount = $scope.alternativeAmount = val; + $scope.globalResult = result + ' ='; $scope.amountResult = toFiat(result); $scope.alternativeResult = fromFiat(result); } @@ -168,10 +174,10 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct $scope.specificAmountBtc = (amountSat * satToBtc).toFixed(8); } - $scope.specificAmount = amount; - $scope.specificAlternativeAmount = alternativeAmount; + $scope.specificAmount = amount.toFixed(2); + $scope.specificAlternativeAmount = alternativeAmount.toFixed(2); } else { - self.setAmount(amount, alternativeAmount, $scope.showAlternativeAmount); + self.setAmount(amount.toFixed(2), alternativeAmount.toFixed(2), $scope.showAlternativeAmount); $scope.cancel(); } }; diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 4b42929de..22f62ba29 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -557,6 +557,13 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }); }; + $scope.openAmountModal = function(address) { + if (isCordova) + $scope.openInputAmountModal(address); + else + $scope.openCustomAmountModal(address); + }; + $scope.openInputAmountModal = function(addr) { var fc = profileService.focusedClient; $scope.color = fc.backgroundColor;