Revert "Click scrolls to focused inputs"

This commit is contained in:
Gustavo Maximiliano Cortez 2016-06-09 15:03:14 -03:00
parent 07064a8679
commit 32d563e367
2 changed files with 37 additions and 35 deletions

View File

@ -352,7 +352,7 @@
send
-->
<ion-content id="send" class="send tab-view" overflow-scroll="true">
<div id="send" class="send tab-view">
<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="home.sendForm" ng-disabled="home.blockUx || home.onGoingProcess" novalidate>
<form name="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="home.sendForm.address.$pristine">
<span class="has-error right size-12" ng-show="home.sendForm.address.$invalid && _address">
<span ng-hide="sendForm.address.$pristine">
<span class="has-error right size-12" ng-show="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="!home.sendForm.address.$invalid">
<small class="right text-primary" ng-show="!sendForm.address.$invalid">
<i class="icon-checkmark-circle size-14"></i>
</small>
</span>
</div>
<div class="input">
<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">
<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">
{{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="home.sendForm.amount.$pristine && !home.sendForm.amount.$modelValue ">
<span class="has-error right size-12" ng-if="home.sendForm.amount.$invalid">
<div class="right" ng-hide="sendForm.amount.$pristine && !sendForm.amount.$modelValue ">
<span class="has-error right size-12" ng-if="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="!home.sendForm.amount.$invalid && !home.sendForm.alternative.$invalid">
<small class="text-primary right" ng-if="!sendForm.amount.$invalid && !sendForm.alternative.$invalid">
<i class="icon-checkmark-circle size-14"></i>
</small>
</div>
@ -460,22 +460,23 @@
<div class="row" ng-hide="home.hideNote">
<div class="large-12 columns">
<label for="comment"><span translate>Description</span>
<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>
<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>
</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(home.sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
<a ng-click="home.resetForm(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="home.sendForm.$invalid || home.blockUx || index.isOffline || home.paymentExpired"
<button class="button black round expand" ng-disabled="sendForm.$invalid || home.blockUx || index.isOffline || home.paymentExpired"
ng-style="{'background-color':index.backgroundColor}" ng-click="home.submitForm()" translate>
Send
</button>
@ -486,7 +487,7 @@
</div>
</div>
<div class="extra-margin-bottom"></div>
</ion-content> <!-- END Send -->
</div> <!-- END Send -->
<div id="{{view.id}}" class="{{view.class}} tab-view" ng-repeat="view in index.addonViews" ng-include="view.template">
</div>
@ -494,4 +495,4 @@
</div>
</div>
<div class="extra-margin-bottom"></div>
<div ng-include="'views/includes/menu.html'" ng-show="!index.noFocusedWallet"></div>
<div ng-include="'views/includes/menu.html'" ng-show="!index.noFocusedWallet && !$root.shouldHideMenuBar"></div>

View File

@ -1,6 +1,6 @@
'use strict';
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) {
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) {
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 = self.sendForm;
var form = $scope.sendForm;
if (form.address.$invalid && !self.blockUx) {
self.resetForm();
self.error = gettext('Could not recognize a valid Bitcoin QR Code');
@ -279,17 +279,20 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
});
}
this.formFocus = function(what) {
if (what == 'msg') {
$timeout(function() {
$ionicScrollDelegate.scrollBottom(true);
}, 300);
this.hideMenuBar = lodash.debounce(function(hide) {
if (hide) {
$rootScope.shouldHideMenuBar = true;
this.bindTouchDown();
} else {
$rootScope.shouldHideMenuBar = false;
}
if (what == 'address') {
$timeout(function() {
$ionicScrollDelegate.scrollTop(true);
}, 300);
$rootScope.$digest();
}, 100);
this.formFocus = function(what) {
if (isCordova && !this.isWindowsPhoneApp) {
this.hideMenuBar(what);
}
var self = this;
@ -319,11 +322,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.hideAmount = true;
}
}
$timeout(function() {
$rootScope.$digest();
}, 1);
};
this.setSendFormInputs = function() {
@ -376,7 +377,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
},
set: function(newValue) {
$scope.__address = self.onAddressChange(newValue);
if (self.sendForm && self.sendForm.address.$valid) {
if ($scope.sendForm && $scope.sendForm.address.$valid) {
self.lockAddress = true;
}
},
@ -436,7 +437,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.hideAmount = false;
}
var form = self.sendForm;
var form = $scope.sendForm;
var comment = form.comment.$modelValue;
// ToDo: use a credential's (or fc's) function for this
@ -574,7 +575,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
};
this.setForm = function(to, amount, comment) {
var form = self.sendForm;
var form = $scope.sendForm;
if (to) {
form.address.$setViewValue(to);
form.address.$isValid = true;
@ -607,7 +608,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this._amount = this._address = null;
var form = self.sendForm;
var form = $scope.sendForm;
if (form && form.amount) {
form.amount.$pristine = true;