From 308919a3050316d1323a52169dc526b485c79009 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 29 Jan 2016 15:21:42 -0300 Subject: [PATCH 1/8] scroll up when error occurs --- public/views/create.html | 6 +++--- public/views/walletHome.html | 2 +- src/js/controllers/create.js | 8 +++++++- src/js/controllers/walletHome.js | 13 +++++++++---- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/public/views/create.html b/public/views/create.html index 98d3e88a8..adaef7f9a 100644 --- a/public/views/create.html +++ b/public/views/create.html @@ -49,13 +49,13 @@
-
+
{{create.error|translate}}
-
+
-
+
diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 77b5e2037..e34fec099 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -395,7 +395,7 @@
-
+
{{home.error|translate}} diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 1433ccdb9..48a3c815a 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('createController', - function($scope, $rootScope, $location, $timeout, $log, lodash, go, profileService, configService, isCordova, gettext, ledger, trezor, isMobile, isChromeApp, isDevel, derivationPathHelper) { + function($scope, $location, $anchorScroll, $rootScope, $timeout, $log, lodash, go, profileService, configService, isCordova, gettext, ledger, trezor, isMobile, isChromeApp, isDevel, derivationPathHelper) { var self = this; var defaults = configService.getDefaults(); @@ -164,6 +164,7 @@ angular.module('copayApp.controllers').controller('createController', if (err) { $log.warn(err); self.error = err; + scrollUp(); $timeout(function() { $rootScope.$apply(); }); @@ -174,6 +175,11 @@ angular.module('copayApp.controllers').controller('createController', }, 100); } + function scrollUp(){ + $location.hash('notification'); + $anchorScroll(); + }; + this.formFocus = function(what) { if (!this.isWindowsPhoneApp) return diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 737849652..49ae1d1d8 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txSignService) { +angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $location, $anchorScroll, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txSignService) { var self = this; window.ignoreMobilePause = false; @@ -97,6 +97,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $rootScope.$digest(); }); + this.scrollUp = function(){ + $location.hash('notification'); + $anchorScroll(); + }; + var accept_msg = gettextCatalog.getString('Accept'); var cancel_msg = gettextCatalog.getString('Cancel'); var confirm_msg = gettextCatalog.getString('Confirm'); @@ -596,7 +601,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }); }; - // Send + // Send this.canShowAlternative = function() { return $scope.showAlternative; @@ -739,7 +744,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment'); this.error = bwsError.msg(err, prefix); - + this.scrollUp(); $timeout(function() { $scope.$digest(); }, 1); @@ -1076,7 +1081,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi } }; - // History + // History function strip(number) { return (parseFloat(number.toPrecision(12))); From 4ed0c7b85c6c5768c3eaf4524fe603e1bc2b1a74 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 29 Jan 2016 15:56:36 -0300 Subject: [PATCH 2/8] refactor scroll method --- src/js/controllers/create.js | 7 ++++--- src/js/controllers/walletHome.js | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 48a3c815a..372f0a53c 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -164,7 +164,7 @@ angular.module('copayApp.controllers').controller('createController', if (err) { $log.warn(err); self.error = err; - scrollUp(); + scrollUp('notification'); $timeout(function() { $rootScope.$apply(); }); @@ -175,8 +175,9 @@ angular.module('copayApp.controllers').controller('createController', }, 100); } - function scrollUp(){ - $location.hash('notification'); + function scrollUp(location){ + if(!location) return; + $location.hash(location); $anchorScroll(); }; diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 49ae1d1d8..4a30c98c2 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -97,8 +97,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $rootScope.$digest(); }); - this.scrollUp = function(){ - $location.hash('notification'); + this.scrollUp = function(location){ + if(!location) return; + $location.hash(location); $anchorScroll(); }; @@ -670,6 +671,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi this.hideAmount = true; } } + this.scrollUp('comment'); $timeout(function() { $rootScope.$digest(); }, 1); @@ -744,7 +746,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment'); this.error = bwsError.msg(err, prefix); - this.scrollUp(); + this.scrollUp('notification'); $timeout(function() { $scope.$digest(); }, 1); From 949106f067e24731a982289c3f84dbd407826014 Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 1 Feb 2016 11:05:42 -0300 Subject: [PATCH 3/8] fix scroll method in Note field --- public/views/walletHome.html | 2 +- src/js/controllers/walletHome.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index e34fec099..e6d401fc5 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -488,7 +488,7 @@
+ ng-blur="home.formFocus(false)" ng-click="home.scrollUp('comment')">
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 4a30c98c2..f44a61fc7 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -671,7 +671,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi this.hideAmount = true; } } - this.scrollUp('comment'); + $timeout(function() { $rootScope.$digest(); }, 1); From 1d3f7345a360271e5a27633353c76dd987855937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 1 Feb 2016 14:03:38 -0300 Subject: [PATCH 4/8] fix note not visible in send tab --- public/views/includes/menu.html | 4 ++-- public/views/walletHome.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/views/includes/menu.html b/public/views/includes/menu.html index 63936035a..e56ed68fc 100644 --- a/public/views/includes/menu.html +++ b/public/views/includes/menu.html @@ -1,4 +1,4 @@ -
+
@@ -9,7 +9,7 @@
-
+
+ ng-blur="home.formFocus(false)">
From 772f97eca194f7149238edafb5ba501bfb7c896f Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 1 Feb 2016 16:18:44 -0300 Subject: [PATCH 5/8] remove scroll in send tab --- public/views/walletHome.html | 2 +- src/js/controllers/walletHome.js | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index e34fec099..77b5e2037 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -395,7 +395,7 @@
-
+
{{home.error|translate}} diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index f44a61fc7..737849652 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $location, $anchorScroll, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txSignService) { +angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txSignService) { var self = this; window.ignoreMobilePause = false; @@ -97,12 +97,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $rootScope.$digest(); }); - this.scrollUp = function(location){ - if(!location) return; - $location.hash(location); - $anchorScroll(); - }; - var accept_msg = gettextCatalog.getString('Accept'); var cancel_msg = gettextCatalog.getString('Cancel'); var confirm_msg = gettextCatalog.getString('Confirm'); @@ -602,7 +596,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }); }; - // Send + // Send this.canShowAlternative = function() { return $scope.showAlternative; @@ -671,7 +665,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi this.hideAmount = true; } } - $timeout(function() { $rootScope.$digest(); }, 1); @@ -746,7 +739,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment'); this.error = bwsError.msg(err, prefix); - this.scrollUp('notification'); + $timeout(function() { $scope.$digest(); }, 1); @@ -1083,7 +1076,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi } }; - // History + // History function strip(number) { return (parseFloat(number.toPrecision(12))); From c5327e065ee953079e3487a4b613b8a786065740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 3 Feb 2016 09:52:48 -0300 Subject: [PATCH 6/8] ng-hide in wallet home html --- public/views/includes/menu.html | 4 ++-- public/views/walletHome.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/views/includes/menu.html b/public/views/includes/menu.html index e56ed68fc..63936035a 100644 --- a/public/views/includes/menu.html +++ b/public/views/includes/menu.html @@ -1,4 +1,4 @@ -
+
@@ -9,7 +9,7 @@
-
+
-
+
From 2b7643922b2db39c1961ea692ff953cddcdaf7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 3 Feb 2016 13:35:52 -0300 Subject: [PATCH 7/8] change variable name --- public/views/walletHome.html | 2 +- src/js/controllers/walletHome.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 5d52fd159..af9cebb86 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -517,4 +517,4 @@
-
+
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 737849652..48d14e062 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi var self = this; window.ignoreMobilePause = false; - $rootScope.hideMenuBar = false; + $rootScope.shouldHideMenuBar = false; $rootScope.wpInputFocused = false; var config = configService.getSync(); var configWallet = config.wallet; @@ -84,7 +84,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi disableFocusListener(); disableResumeListener(); disableOngoingProcessListener(); - $rootScope.hideMenuBar = false; + $rootScope.shouldHideMenuBar = false; }); this.onQrCodeScanned = function(data) { @@ -638,10 +638,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi this.hideMenuBar = lodash.debounce(function(hide) { if (hide) { - $rootScope.hideMenuBar = true; + $rootScope.shouldHideMenuBar = true; this.bindTouchDown(); } else { - $rootScope.hideMenuBar = false; + $rootScope.shouldHideMenuBar = false; } $rootScope.$digest(); }, 100); From fa4140e723a1745a6f2a5d8896647368eb18e877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 3 Feb 2016 16:27:53 -0300 Subject: [PATCH 8/8] refactor --- public/views/walletHome.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index af9cebb86..84045dd38 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -517,4 +517,4 @@
-
+