scroll up in forms

This commit is contained in:
Javier 2016-05-30 16:32:28 -03:00
parent 736056fd20
commit 97013ea5b6
7 changed files with 48 additions and 33 deletions

View File

@ -6,7 +6,7 @@
<div class="content p20b" ng-controller="createController as create" ng-init="create.setTotalCopayers(1)"> <ion-content overflow-scroll="true" class="content p20b" ng-controller="createController as create" ng-init="create.setTotalCopayers(1)">
<div class="onGoingProcess" ng-show="create.loading && !create.hwWallet"> <div class="onGoingProcess" ng-show="create.loading && !create.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}"> <div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
@ -173,5 +173,5 @@
</div> <!-- large-12 columns --> </div> <!-- large-12 columns -->
</div> <!-- row --> </div> <!-- row -->
</form> </form>
</div> </ion-content>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View File

@ -4,7 +4,7 @@
ng-init="titleSection='Import wallet'; goBackToState = 'add'; noColor = true"> ng-init="titleSection='Import wallet'; goBackToState = 'add'; noColor = true">
</div> </div>
<div class="content p20b" ng-controller="importController as import" ng-init="type='12'"> <ion-content overflow-scroll="true" class="content p20b" ng-controller="importController as import" ng-init="type='12'">
<div class="onGoingProcess" ng-show="import.loading && !import.hwWallet"> <div class="onGoingProcess" ng-show="import.loading && !import.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}"> <div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner> <ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
@ -220,6 +220,6 @@
</form> </form>
</div> </div>
</div> </div>
</div> </ion-content>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View File

@ -5,7 +5,7 @@
</div> </div>
<div class="content p20v" ng-controller="joinController as join"> <ion-content overflow-scroll="true" class="content p20v" ng-controller="joinController as join">
<div class="onGoingProcess" ng-show="join.loading && !join.hwWallet"> <div class="onGoingProcess" ng-show="join.loading && !join.hwWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}"> <div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner> <ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
@ -22,7 +22,7 @@
</div> </div>
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate> <form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<div class="box-notification m20b" ng-show="join.error "> <div class="box-notification m20b" ng-show="join.error">
<span class="text-warning"> <span class="text-warning">
{{join.error|translate}} {{join.error|translate}}
</span> </span>
@ -141,6 +141,6 @@
</div> <!-- large-12 columns --> </div> <!-- large-12 columns -->
</div> <!-- row --> </div> <!-- row -->
</form> </form>
</div> </ion-content>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View File

@ -54,7 +54,7 @@
--> -->
<ion-content id="walletHome" class="walletHome tab-view tab-in" scroll="false"> <ion-content id="walletHome" class="walletHome tab-view tab-in" scroll="false">
<ion-content overflow-scroll="false" delegate-handle="transactions" on-scroll="freezeScroll()"> <ion-content overflow-scroll="true" delegate-handle="transactions" on-scroll="freezeScroll()">
<ion-refresher <ion-refresher
pulling-icon="ion-ios-refresh" pulling-icon="ion-ios-refresh"
spinner="ios-small" spinner="ios-small"

View File

@ -1,13 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('createController', angular.module('copayApp.controllers').controller('createController',
function($scope, $location, $anchorScroll, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper) { function($scope, $ionicScrollDelegate, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
var self = this; var self = this;
var defaults = configService.getDefaults(); var defaults = configService.getDefaults();
this.isWindowsPhoneApp = platformInfo.isWP && isCordova; this.isWindowsPhoneApp = platformInfo.isWP && isCordova;
@ -90,6 +89,7 @@ angular.module('copayApp.controllers').controller('createController',
this.create = function(form) { this.create = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
this.error = gettext('Please enter the required fields'); this.error = gettext('Please enter the required fields');
$ionicScrollDelegate.scrollTop();
return; return;
} }
@ -116,6 +116,7 @@ angular.module('copayApp.controllers').controller('createController',
var pathData = derivationPathHelper.parse($scope.derivationPath); var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) { if (!pathData) {
this.error = gettext('Invalid derivation path'); this.error = gettext('Invalid derivation path');
$ionicScrollDelegate.scrollTop();
return; return;
} }
@ -129,6 +130,7 @@ angular.module('copayApp.controllers').controller('createController',
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) { if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase'); this.error = gettext('Please enter the wallet recovery phrase');
$ionicScrollDelegate.scrollTop();
return; return;
} }
@ -136,6 +138,7 @@ angular.module('copayApp.controllers').controller('createController',
var account = $scope.account; var account = $scope.account;
if (!account || account < 1) { if (!account || account < 1) {
this.error = gettext('Invalid account number'); this.error = gettext('Invalid account number');
$ionicScrollDelegate.scrollTop();
return; return;
} }
@ -150,6 +153,7 @@ angular.module('copayApp.controllers').controller('createController',
self.hwWallet = false; self.hwWallet = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
$scope.$apply(); $scope.$apply();
return; return;
} }
@ -170,7 +174,7 @@ angular.module('copayApp.controllers').controller('createController',
if (err) { if (err) {
$log.warn(err); $log.warn(err);
self.error = err; self.error = err;
scrollUp('notification'); $ionicScrollDelegate.scrollTop();
$timeout(function() { $timeout(function() {
$rootScope.$apply(); $rootScope.$apply();
}); });
@ -182,12 +186,6 @@ angular.module('copayApp.controllers').controller('createController',
}, 100); }, 100);
} }
function scrollUp(location) {
if (!location) return;
$location.hash(location);
$anchorScroll();
};
this.formFocus = function(what) { this.formFocus = function(what) {
if (!this.isWindowsPhoneApp) return if (!this.isWindowsPhoneApp) return

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('importController', angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo) { function($scope, $rootScope, $ionicScrollDelegate, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, derivationPathHelper, platformInfo) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -39,8 +39,6 @@ angular.module('copayApp.controllers').controller('importController',
} }
}; };
this.setType = function(type) { this.setType = function(type) {
$scope.type = type; $scope.type = type;
this.error = null; this.error = null;
@ -60,6 +58,7 @@ angular.module('copayApp.controllers').controller('importController',
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
$timeout(function() { $timeout(function() {
$rootScope.$apply(); $rootScope.$apply();
}); });
@ -75,6 +74,7 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false; self.loading = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
} else { } else {
$rootScope.$emit('Local/WalletImported', walletId); $rootScope.$emit('Local/WalletImported', walletId);
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly')); notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
@ -92,6 +92,7 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false; self.loading = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
return $timeout(function() { return $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -111,6 +112,7 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false; self.loading = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
return $timeout(function() { return $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -136,7 +138,7 @@ angular.module('copayApp.controllers').controller('importController',
this.importBlob = function(form) { this.importBlob = function(form) {
if (form.$invalid) { if (form.$invalid) {
this.error = gettext('There is an error in the form'); this.error = gettext('There is an error in the form');
$ionicScrollDelegate.scrollTop();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -149,6 +151,7 @@ angular.module('copayApp.controllers').controller('importController',
if (!backupFile && !backupText) { if (!backupFile && !backupText) {
this.error = gettext('Please, select your backup file'); this.error = gettext('Please, select your backup file');
$ionicScrollDelegate.scrollTop();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -168,7 +171,7 @@ angular.module('copayApp.controllers').controller('importController',
this.importMnemonic = function(form) { this.importMnemonic = function(form) {
if (form.$invalid) { if (form.$invalid) {
this.error = gettext('There is an error in the form'); this.error = gettext('There is an error in the form');
$ionicScrollDelegate.scrollTop();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -183,6 +186,7 @@ angular.module('copayApp.controllers').controller('importController',
var pathData = derivationPathHelper.parse($scope.derivationPath); var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) { if (!pathData) {
this.error = gettext('Invalid derivation path'); this.error = gettext('Invalid derivation path');
$ionicScrollDelegate.scrollTop();
return; return;
} }
opts.account = pathData.account; opts.account = pathData.account;
@ -194,13 +198,16 @@ angular.module('copayApp.controllers').controller('importController',
if (!words) { if (!words) {
this.error = gettext('Please enter the recovery phrase'); this.error = gettext('Please enter the recovery phrase');
$ionicScrollDelegate.scrollTop();
} else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) { } else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) {
return _importExtendedPrivateKey(words, opts); return _importExtendedPrivateKey(words, opts);
} else { } else {
var wordList = words.split(/[\u3000\s]+/); var wordList = words.split(/[\u3000\s]+/);
if ((wordList.length % 3) != 0) if ((wordList.length % 3) != 0) {
this.error = gettext('Wrong number of recovery words:') + wordList.length; this.error = gettext('Wrong number of recovery words:') + wordList.length;
$ionicScrollDelegate.scrollTop();
}
} }
if (this.error) { if (this.error) {
@ -222,6 +229,7 @@ angular.module('copayApp.controllers').controller('importController',
self.hwWallet = false; self.hwWallet = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
$scope.$apply(); $scope.$apply();
return; return;
} }
@ -235,6 +243,7 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false; self.loading = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
return $timeout(function() { return $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -247,8 +256,9 @@ angular.module('copayApp.controllers').controller('importController',
}; };
this.importHW = function(form) { this.importHW = function(form) {
if (form.$invalid || $scope.account < 0 ) { if (form.$invalid || $scope.account < 0) {
this.error = gettext('There is an error in the form'); this.error = gettext('There is an error in the form');
$ionicScrollDelegate.scrollTop();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
@ -256,11 +266,12 @@ angular.module('copayApp.controllers').controller('importController',
} }
this.error = ''; this.error = '';
var account = + $scope.account; var account = +$scope.account;
if (self.seedSourceId == 'trezor') { if (self.seedSourceId == 'trezor') {
if ( account < 1) { if (account < 1) {
this.error = gettext('Invalid account number'); this.error = gettext('Invalid account number');
$ionicScrollDelegate.scrollTop();
return; return;
} }
account = account - 1; account = account - 1;
@ -296,6 +307,7 @@ angular.module('copayApp.controllers').controller('importController',
self.hwWallet = false; self.hwWallet = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
$scope.$apply(); $scope.$apply();
return; return;
} }
@ -309,6 +321,7 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false; self.loading = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
return $timeout(function() { return $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('joinController', angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper) { function($scope, $rootScope, $timeout, $ionicScrollDelegate, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper) {
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel; var isDevel = platformInfo.isDevel;
@ -18,7 +18,6 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.joinForm.secret.$render(); $scope.joinForm.secret.$render();
}; };
var updateSeedSourceSelect = function() { var updateSeedSourceSelect = function() {
self.seedOptions = [{ self.seedOptions = [{
id: 'new', id: 'new',
@ -56,6 +55,7 @@ angular.module('copayApp.controllers').controller('joinController',
this.join = function(form) { this.join = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
self.error = gettext('Please enter the required fields'); self.error = gettext('Please enter the required fields');
$ionicScrollDelegate.scrollTop();
return; return;
} }
@ -65,7 +65,7 @@ angular.module('copayApp.controllers').controller('joinController',
bwsurl: $scope.bwsurl, bwsurl: $scope.bwsurl,
} }
var setSeed = self.seedSourceId =='set'; var setSeed = self.seedSourceId == 'set';
if (setSeed) { if (setSeed) {
var words = form.privateKey.$modelValue; var words = form.privateKey.$modelValue;
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) { if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
@ -78,6 +78,7 @@ angular.module('copayApp.controllers').controller('joinController',
var pathData = derivationPathHelper.parse($scope.derivationPath); var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) { if (!pathData) {
this.error = gettext('Invalid derivation path'); this.error = gettext('Invalid derivation path');
$ionicScrollDelegate.scrollTop();
return; return;
} }
opts.account = pathData.account; opts.account = pathData.account;
@ -91,6 +92,7 @@ angular.module('copayApp.controllers').controller('joinController',
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) { if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase'); this.error = gettext('Please enter the wallet recovery phrase');
$ionicScrollDelegate.scrollTop();
return; return;
} }
@ -98,14 +100,14 @@ angular.module('copayApp.controllers').controller('joinController',
var account = $scope.account; var account = $scope.account;
if (!account || account < 1) { if (!account || account < 1) {
this.error = gettext('Invalid account number'); this.error = gettext('Invalid account number');
$ionicScrollDelegate.scrollTop();
return; return;
} }
if ( self.seedSourceId == 'trezor') if (self.seedSourceId == 'trezor')
account = account - 1; account = account - 1;
opts.account = account; opts.account = account;
self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor'; self.hwWallet = self.seedSourceId == 'ledger' ? 'Ledger' : 'Trezor';
var src = self.seedSourceId == 'ledger' ? ledger : trezor; var src = self.seedSourceId == 'ledger' ? ledger : trezor;
@ -113,6 +115,7 @@ angular.module('copayApp.controllers').controller('joinController',
self.hwWallet = false; self.hwWallet = false;
if (err) { if (err) {
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
$scope.$apply(); $scope.$apply();
return; return;
} }
@ -132,6 +135,7 @@ angular.module('copayApp.controllers').controller('joinController',
if (err) { if (err) {
self.loading = false; self.loading = false;
self.error = err; self.error = err;
$ionicScrollDelegate.scrollTop();
$rootScope.$apply(); $rootScope.$apply();
return; return;
} }