mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #4309 from gabrielbazan7/fix/ScrollSend
Click scrolls to focused inputs
This commit is contained in:
commit
88de164318
|
@ -352,7 +352,7 @@
|
|||
send
|
||||
|
||||
-->
|
||||
<div id="send" class="send tab-view">
|
||||
<ion-content id="send" class="send tab-view" overflow-scroll="true">
|
||||
<div class="pr p25b">
|
||||
<h4 class="title m0">
|
||||
<available-balance ng-show="!index.shouldHideBalance"></available-balance>
|
||||
|
@ -380,27 +380,27 @@
|
|||
</div>
|
||||
<div class="row m20t">
|
||||
<div class="large-12 large-centered columns">
|
||||
<form name="sendForm" ng-disabled="home.blockUx || home.onGoingProcess" novalidate>
|
||||
<form name="home.sendForm" ng-disabled="home.blockUx || home.onGoingProcess" novalidate>
|
||||
|
||||
<div ng-hide="home._paypro || home.hideAddress">
|
||||
<div class="row collapse">
|
||||
<label for="address" class="left" >
|
||||
<span translate>To</span>
|
||||
</label>
|
||||
<span ng-hide="sendForm.address.$pristine">
|
||||
<span class="has-error right size-12" ng-show="sendForm.address.$invalid && _address">
|
||||
<span ng-hide="home.sendForm.address.$pristine">
|
||||
<span class="has-error right size-12" ng-show="home.sendForm.address.$invalid && _address">
|
||||
<i class="icon-close-circle size-14"></i>
|
||||
<span class="vm" translate>Not valid</span>
|
||||
</span>
|
||||
<small class="right text-primary" ng-show="!sendForm.address.$invalid">
|
||||
<small class="right text-primary" ng-show="!home.sendForm.address.$invalid">
|
||||
<i class="icon-checkmark-circle size-14"></i>
|
||||
</small>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
<input ng-show="sendForm.address.$invalid" class="m0" type="text" id="address" name="address" ng-disabled="home.blockUx || home.lockAddress" ng-attr-placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required ng-focus="home.formFocus('address')" ng-blur="home.formFocus(false)">
|
||||
<div class="addressbook-input" ng-show="!sendForm.address.$invalid && _address">
|
||||
<input ng-show="home.sendForm.address.$invalid" class="m0" type="text" id="address" name="address" ng-disabled="home.blockUx || home.lockAddress" ng-attr-placeholder="{{'Bitcoin address'|translate}}" ng-model="_address" valid-address required ng-focus="home.formFocus('address')" ng-blur="home.formFocus(false)">
|
||||
<div class="addressbook-input" ng-show="!home.sendForm.address.$invalid && _address">
|
||||
{{index.addressbook[_address] || _address}}
|
||||
</div>
|
||||
<a class="postfix size-12 m0 text-gray"
|
||||
|
@ -427,12 +427,12 @@
|
|||
|
||||
<div class="row" ng-init="home.hideAlternative()" ng-hide="home.hideAmount">
|
||||
<div class="large-12 medium-12 columns">
|
||||
<div class="right" ng-hide="sendForm.amount.$pristine && !sendForm.amount.$modelValue ">
|
||||
<span class="has-error right size-12" ng-if="sendForm.amount.$invalid">
|
||||
<div class="right" ng-hide="home.sendForm.amount.$pristine && !home.sendForm.amount.$modelValue ">
|
||||
<span class="has-error right size-12" ng-if="home.sendForm.amount.$invalid">
|
||||
<i class="icon-close-circle size-14"></i>
|
||||
<span clas="vm" translate>Not valid</span>
|
||||
</span>
|
||||
<small class="text-primary right" ng-if="!sendForm.amount.$invalid && !sendForm.alternative.$invalid">
|
||||
<small class="text-primary right" ng-if="!home.sendForm.amount.$invalid && !home.sendForm.alternative.$invalid">
|
||||
<i class="icon-checkmark-circle size-14"></i>
|
||||
</small>
|
||||
</div>
|
||||
|
@ -460,23 +460,22 @@
|
|||
<div class="row" ng-hide="home.hideNote">
|
||||
<div class="large-12 columns">
|
||||
<label for="comment"><span translate>Description</span>
|
||||
<small translate ng-hide="!sendForm.comment.$pristine">optional</small>
|
||||
<small translate class="has-error" ng-show="sendForm.comment.$invalid && !sendForm.comment.$pristine">too long!</small>
|
||||
<small translate ng-hide="!home.sendForm.comment.$pristine">optional</small>
|
||||
<small translate class="has-error" ng-show="home.sendForm.comment.$invalid && !home.sendForm.comment.$pristine">too long!</small>
|
||||
</label>
|
||||
<div class="input">
|
||||
<textarea id="comment" ng-disabled="home.blockUx" name="comment"
|
||||
ng-maxlength="500" ng-model="_comment" ng-focus="home.formFocus('msg')"
|
||||
ng-blur="home.formFocus(false)"></textarea>
|
||||
ng-maxlength="500" ng-model="_comment" ng-focus="home.formFocus('msg')" ng-blur="home.formFocus(false)"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="!home.onGoingProcess">
|
||||
<div class="large-6 medium-6 small-6 columns" ng-show="!home.blockUx && (home._paypro || home.lockAddress || home.lockAmount)">
|
||||
<a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
|
||||
<a ng-click="home.resetForm(home.sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
|
||||
</div>
|
||||
<div class="columns" ng-class="{'small-6 medium-6 large-6':(home._paypro || home.lockAddress || home.lockAmount)}">
|
||||
<button class="button black round expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline || home.paymentExpired"
|
||||
<button class="button black round expand" ng-disabled="home.sendForm.$invalid || home.blockUx || index.isOffline || home.paymentExpired"
|
||||
ng-style="{'background-color':index.backgroundColor}" ng-click="home.submitForm()" translate>
|
||||
Send
|
||||
</button>
|
||||
|
@ -487,7 +486,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
</div> <!-- END Send -->
|
||||
</ion-content> <!-- END Send -->
|
||||
|
||||
<div id="{{view.id}}" class="{{view.class}} tab-view" ng-repeat="view in index.addonViews" ng-include="view.template">
|
||||
</div>
|
||||
|
@ -495,4 +494,4 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
<div ng-include="'views/includes/menu.html'" ng-show="!index.noFocusedWallet && !$root.shouldHideMenuBar"></div>
|
||||
<div ng-include="'views/includes/menu.html'" ng-show="!index.noFocusedWallet"></div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
|
||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $ionicScrollDelegate, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) {
|
||||
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isWP = platformInfo.isWP;
|
||||
|
@ -36,7 +36,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
self.setForm(data);
|
||||
$rootScope.$emit('Local/SetTab', 'send');
|
||||
|
||||
var form = $scope.sendForm;
|
||||
var form = self.sendForm;
|
||||
if (form.address.$invalid && !self.blockUx) {
|
||||
self.resetForm();
|
||||
self.error = gettext('Could not recognize a valid Bitcoin QR Code');
|
||||
|
@ -279,20 +279,17 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
});
|
||||
}
|
||||
|
||||
this.hideMenuBar = lodash.debounce(function(hide) {
|
||||
if (hide) {
|
||||
$rootScope.shouldHideMenuBar = true;
|
||||
this.bindTouchDown();
|
||||
} else {
|
||||
$rootScope.shouldHideMenuBar = false;
|
||||
}
|
||||
$rootScope.$digest();
|
||||
}, 100);
|
||||
|
||||
|
||||
this.formFocus = function(what) {
|
||||
if (isCordova && !this.isWindowsPhoneApp) {
|
||||
this.hideMenuBar(what);
|
||||
|
||||
if (what == 'msg') {
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.scrollBottom(true);
|
||||
}, 300);
|
||||
}
|
||||
if (what == 'address') {
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.scrollTop(true);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
@ -322,9 +319,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
this.hideAmount = true;
|
||||
}
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
|
||||
};
|
||||
|
||||
this.setSendFormInputs = function() {
|
||||
|
@ -377,7 +376,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
},
|
||||
set: function(newValue) {
|
||||
$scope.__address = self.onAddressChange(newValue);
|
||||
if ($scope.sendForm && $scope.sendForm.address.$valid) {
|
||||
if (self.sendForm && self.sendForm.address.$valid) {
|
||||
self.lockAddress = true;
|
||||
}
|
||||
},
|
||||
|
@ -437,7 +436,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
this.hideAmount = false;
|
||||
}
|
||||
|
||||
var form = $scope.sendForm;
|
||||
var form = self.sendForm;
|
||||
var comment = form.comment.$modelValue;
|
||||
|
||||
// ToDo: use a credential's (or fc's) function for this
|
||||
|
@ -575,7 +574,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
};
|
||||
|
||||
this.setForm = function(to, amount, comment) {
|
||||
var form = $scope.sendForm;
|
||||
var form = self.sendForm;
|
||||
if (to) {
|
||||
form.address.$setViewValue(to);
|
||||
form.address.$isValid = true;
|
||||
|
@ -608,7 +607,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this._amount = this._address = null;
|
||||
|
||||
var form = $scope.sendForm;
|
||||
var form = self.sendForm;
|
||||
|
||||
if (form && form.amount) {
|
||||
form.amount.$pristine = true;
|
||||
|
|
Loading…
Reference in New Issue