scroll up when error occurs

This commit is contained in:
Javier 2016-01-29 15:21:42 -03:00
parent 0875b7dd5b
commit 308919a305
4 changed files with 20 additions and 9 deletions

View File

@ -49,7 +49,7 @@
</div>
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
<div class="box-notification m20b" ng-show="create.error">
<div class="box-notification m20b" id="notification" ng-show="create.error">
<span class="text-warning">
{{create.error|translate}}
</span>

View File

@ -395,7 +395,7 @@
<qr-scanner on-scan="home.onQrCodeScanned(data)"></qr-scanner>
</div>
</div>
<div class="box-notification m20t" ng-show="home.error" ng-click="home.resetError()">
<div class="box-notification m20t" id="notification" ng-show="home.error" ng-click="home.resetError()">
<span class="text-warning">
{{home.error|translate}}
</span>

View File

@ -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

View File

@ -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');
@ -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);