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-content" ng-style="{'background-color':'#222'}">
@ -173,5 +173,5 @@
</div> <!-- large-12 columns -->
</div> <!-- row -->
</form>
</div>
</ion-content>
<div class="extra-margin-bottom"></div>

View File

@ -4,7 +4,7 @@
ng-init="titleSection='Import wallet'; goBackToState = 'add'; noColor = true">
</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-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
@ -220,6 +220,6 @@
</form>
</div>
</div>
</div>
</ion-content>
<div class="extra-margin-bottom"></div>

View File

@ -5,7 +5,7 @@
</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-content" ng-style="{'background-color':'#222'}">
<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>
@ -22,7 +22,7 @@
</div>
<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">
{{join.error|translate}}
</span>
@ -141,6 +141,6 @@
</div> <!-- large-12 columns -->
</div> <!-- row -->
</form>
</div>
</ion-content>
<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 overflow-scroll="false" delegate-handle="transactions" on-scroll="freezeScroll()">
<ion-content overflow-scroll="true" delegate-handle="transactions" on-scroll="freezeScroll()">
<ion-refresher
pulling-icon="ion-ios-refresh"
spinner="ios-small"

View File

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

View File

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

View File

@ -1,7 +1,7 @@
'use strict';
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 isDevel = platformInfo.isDevel;
@ -18,7 +18,6 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.joinForm.secret.$render();
};
var updateSeedSourceSelect = function() {
self.seedOptions = [{
id: 'new',
@ -56,6 +55,7 @@ angular.module('copayApp.controllers').controller('joinController',
this.join = function(form) {
if (form && form.$invalid) {
self.error = gettext('Please enter the required fields');
$ionicScrollDelegate.scrollTop();
return;
}
@ -65,7 +65,7 @@ angular.module('copayApp.controllers').controller('joinController',
bwsurl: $scope.bwsurl,
}
var setSeed = self.seedSourceId =='set';
var setSeed = self.seedSourceId == 'set';
if (setSeed) {
var words = form.privateKey.$modelValue;
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);
if (!pathData) {
this.error = gettext('Invalid derivation path');
$ionicScrollDelegate.scrollTop();
return;
}
opts.account = pathData.account;
@ -91,6 +92,7 @@ angular.module('copayApp.controllers').controller('joinController',
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase');
$ionicScrollDelegate.scrollTop();
return;
}
@ -98,14 +100,14 @@ angular.module('copayApp.controllers').controller('joinController',
var account = $scope.account;
if (!account || account < 1) {
this.error = gettext('Invalid account number');
$ionicScrollDelegate.scrollTop();
return;
}
if ( self.seedSourceId == 'trezor')
if (self.seedSourceId == 'trezor')
account = account - 1;
opts.account = account;
opts.account = account;
self.hwWallet = 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;
if (err) {
self.error = err;
$ionicScrollDelegate.scrollTop();
$scope.$apply();
return;
}
@ -132,6 +135,7 @@ angular.module('copayApp.controllers').controller('joinController',
if (err) {
self.loading = false;
self.error = err;
$ionicScrollDelegate.scrollTop();
$rootScope.$apply();
return;
}