From 8c16460d29a01acd348d939b68cd0b88e86718bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Sat, 4 Jun 2016 15:19:42 -0300 Subject: [PATCH] change confirmation and alert modal for confirmation ionic popup --- public/index.html | 2 - public/views/includes/alert.html | 21 +++----- public/views/includes/confirm-tx.html | 74 ++++++++++++--------------- public/views/includes/password.html | 10 ++-- src/css/ionic-migration.css | 4 ++ src/js/controllers/confirmTx.js | 23 --------- src/js/controllers/index.js | 68 +++++++++++++++++------- src/sass/main.scss | 74 ++++----------------------- 8 files changed, 108 insertions(+), 168 deletions(-) delete mode 100644 src/js/controllers/confirmTx.js diff --git a/public/index.html b/public/index.html index 1c9de69a6..7056d8ee1 100644 --- a/public/index.html +++ b/public/index.html @@ -27,8 +27,6 @@
-
-
-
- -
-
-
- - {{index.showAlert.msg|translate}} -
-
- OK -
+
+
+ + {{msg|translate}}
-
+
+ OK +
+
diff --git a/public/views/includes/confirm-tx.html b/public/views/includes/confirm-tx.html index 57f348423..e39e4a7cc 100644 --- a/public/views/includes/confirm-tx.html +++ b/public/views/includes/confirm-tx.html @@ -1,47 +1,39 @@ -
- -
- -
-

Send bitcoin

+
+ +
+
+
{{tx.amountStr}}
+
{{tx.alternativeAmountStr}}
+ +
+ + + + Multiple recipients +
-
-
{{tx.amountStr}}
-
{{tx.alternativeAmountStr}}
- -
- - - - Multiple recipients - +
+
+ Fee ({{feeLevel|translate}}): + {{tx.feeStr}} + {{feeAlternativeStr}}
-
-
- Fee ({{confirm.feeLevel|translate}}): - {{tx.feeStr}} - {{confirm.feeAlternativeStr}} -
-
- {{confirm.feeRateStr}} of the transaction -
+
+ {{feeRateStr}} of the transaction
-
-
- -
-
- -
+
+
+
+ +
+
+
diff --git a/public/views/includes/password.html b/public/views/includes/password.html index d2bc23831..05344c6b7 100644 --- a/public/views/includes/password.html +++ b/public/views/includes/password.html @@ -10,7 +10,7 @@
+ id="passwordInput" name="password" ng-model="data.password" autofocus>
@@ -18,8 +18,8 @@
@@ -28,8 +28,8 @@ ng-click="set()" ng-disabled="!data.password || loading" ng-style="{'background-color':index.backgroundColor}"> - SET - OK + SET + OK
diff --git a/src/css/ionic-migration.css b/src/css/ionic-migration.css index 7a7ac7a1c..c8dfbdff7 100644 --- a/src/css/ionic-migration.css +++ b/src/css/ionic-migration.css @@ -32,6 +32,10 @@ display: none; } +.popup-body { + padding: 0px; +} + .bct { background-color: transparent !important; margin-top: -25px; diff --git a/src/js/controllers/confirmTx.js b/src/js/controllers/confirmTx.js deleted file mode 100644 index 66180c8c5..000000000 --- a/src/js/controllers/confirmTx.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('confirmTxController', function(configService, feeService, rateService) { - - - this.processFee = function(amount, fee) { - var walletSettings = configService.getSync().wallet.settings; - var feeAlternativeIsoCode = walletSettings.alternativeIsoCode; - - this.feeLevel = feeService.feeOpts[feeService.getCurrentFeeLevel()]; - this.feeAlternativeStr = parseFloat((rateService.toFiat(fee, feeAlternativeIsoCode)).toFixed(2), 10) + ' ' + feeAlternativeIsoCode; - this.feeRateStr = (fee / (amount + fee) * 100).toFixed(2) + '%' ; - }; - - this.close = function(cb) { - return cb(); - }; - - this.accept = function(cb) { - return cb(true); - }; - -}); diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 1a38d871a..eebe2b591 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) { +angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) { var self = this; var SOFT_CONFIRMATION_LIMIT = 12; var errors = bwcService.getErrors(); @@ -1111,15 +1111,23 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.showErrorPopup = function(msg, cb) { $log.warn('Showing err popup:' + msg); - self.showAlert = { - msg: msg, - close: function() { - self.showAlert = null; - if (cb) return cb(); - }, - }; - $timeout(function() { - $rootScope.$apply(); + + function openErrorPopup(msg, cb) { + $scope.msg = msg; + + self.errorPopup = $ionicPopup.show({ + templateUrl: 'views/includes/alert.html', + scope: $scope, + }); + + $scope.close = function() { + return cb(); + }; + } + + openErrorPopup(msg, function() { + self.errorPopup.close(); + if (cb) return cb(); }); }; @@ -1864,15 +1872,37 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); $rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) { - self.confirmTx = { - txp: txFormatService.processTx(txp), - callback: function(accept) { - self.confirmTx = null; - return cb(accept); - } - }; - $timeout(function() { - $rootScope.$apply(); + + function openConfirmationPopup(txp, cb) { + + $scope.tx = txFormatService.processTx(txp); + + self.confirmationPopup = $ionicPopup.show({ + templateUrl: 'views/includes/confirm-tx.html', + scope: $scope, + }); + + $scope.processFee = function(amount, fee) { + var walletSettings = configService.getSync().wallet.settings; + var feeAlternativeIsoCode = walletSettings.alternativeIsoCode; + + $scope.feeLevel = feeService.feeOpts[feeService.getCurrentFeeLevel()]; + $scope.feeAlternativeStr = parseFloat((rateService.toFiat(fee, feeAlternativeIsoCode)).toFixed(2), 10) + ' ' + feeAlternativeIsoCode; + $scope.feeRateStr = (fee / (amount + fee) * 100).toFixed(2) + '%'; + }; + + $scope.cancel = function() { + return cb(); + }; + + $scope.accept = function() { + return cb(true); + }; + } + + openConfirmationPopup(txp, function(accept) { + self.confirmationPopup.close(); + return cb(accept); }); }); diff --git a/src/sass/main.scss b/src/sass/main.scss index 58bb6bfd9..4ae80b511 100644 --- a/src/sass/main.scss +++ b/src/sass/main.scss @@ -89,7 +89,7 @@ h4.title a { } } -.modal-content h4, .glidera h4, .coinbase h4, .txModal h4 { +.modal-content h4, .glidera h4, .coinbase h4 { background: #F6F7F9; padding: 25px 0px 5px 10px; text-transform: uppercase; @@ -105,7 +105,7 @@ h4.title a { font-size: 16px; } -.preferences ul, .modal-content ul, .txModal ul { +.preferences ul, .modal-content ul { font-size: 14px; background: white; } @@ -255,6 +255,12 @@ a { position: relative; } + +.half-row { + width: 50%; + padding: 5px; +} + .content { width: 100%; position: absolute; @@ -1339,61 +1345,6 @@ input.ng-invalid-match { } } -/* Confirmation popup */ - -.confirmTxModal { - background: white; - border-radius: 5px; - position: absolute; - width: 90%; - left: 0; - right: 0; - margin: 15% auto; - z-index: 1100; - text-align: center; -} - -.confirmHead { - padding: 10px; - border-top-left-radius: 5px; - border-top-right-radius: 5px; -} - -.txModal-content { - overflow: auto; - height: 100%; - padding-bottom: 50px; -} - -.txModal { - background: #f6f7f9; - position: absolute; - width: 100%; - top: 0; - bottom: 0; - overflow: hidden; - z-index: 1100; -} - -.alertModal, .passModal { - background: #FFFFFF; - border-radius: 5px; - position: absolute; - width: 90%; - left: 5%; - top: 15%; - z-index: 1100; -} - -.modalMask { - position: absolute; - width: 100%; - height: 100%; - z-index: 1099; - opacity: 0.8; - background: black; -} - .tx-details-blockchain li { cursor: pointer !important; } @@ -2006,13 +1957,6 @@ body.modal-open { } } -.txModal.animated { - &.slideInRight, &.slideOutRight { - -webkit-animation-duration: 0.3s; - animation-duration: 0.3s; - } -} - .reveal-modal.animated { &.fadeOutUp, &.slideInUp, &.slideInDown { -webkit-animation-duration: 0.3s; @@ -2068,7 +2012,7 @@ body.modal-open { padding: 5px 15px; background-color: rgba(0, 0, 0, 0.1); i { - position: absolute; + position: inherit; left: 25px; padding-right: 10px; border-right: 1px solid;