prevents keyboard show on mobile (read-only input)

This commit is contained in:
Javier 2016-07-20 11:27:15 -03:00
parent b3fcdf8584
commit ba59a4f137
3 changed files with 32 additions and 6 deletions

View File

@ -404,7 +404,7 @@
</div>
</div>
<div class="row" ng-init="home.hideAlternative()">
<div class="row">
<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-show="sendForm.amount.$invalid">
@ -420,8 +420,8 @@
<span translate>Amount</span><span ng-show="showAlternative"> [{{home.alternativeIsoCode}}]</span>
</label>
<div class="input">
<input type="number" ng-show="!showAlternative" id="amount" ng-disabled="home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="openInputAmountModal()" ignore-mouse-wheel>
<input type="number" ng-show="showAlternative" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="openInputAmountModal()" ignore-mouse-wheel>
<input type="amount" readonly="true" ng-show="!showAlternative" id="amount" ng-disabled="home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="openInputAmountModal()" ignore-mouse-wheel>
<input type="amount" readonly="true" ng-show="showAlternative" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="openInputAmountModal()" ignore-mouse-wheel>
<a class="postfix button" ng-show="!showAlternative" ng-style="{'background-color':index.backgroundColor}" ng-click="showAlternative = !showAlternative">{{home.unitName}}</a>
<a class="postfix button black" ng-show="showAlternative" ng-click="showAlternative = !showAlternative">{{home.alternativeIsoCode}}</a>
</div>

View File

@ -30,6 +30,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
ret.countDown = null;
ret.sendMaxInfo = {};
ret.showAlternative = false;
ret.fromInputAmount = null;
var vanillaScope = ret;
var disableScannerListener = $rootScope.$on('dataScanned', function(event, data) {
@ -286,7 +287,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
},
set: function(newValue) {
$scope.__alternative = newValue;
if (typeof(newValue) === 'number' && self.isRateAvailable) {
if (self.isRateAvailable) {
$scope._amount = parseFloat((rateService.fromFiat(newValue, self.alternativeIsoCode) * satToUnit).toFixed(self.unitDecimals), 10);
} else {
$scope.__amount = null;
@ -302,7 +303,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
},
set: function(newValue) {
$scope.__amount = newValue;
if (typeof(newValue) === 'number' && self.isRateAvailable) {
if (self.isRateAvailable) {
$scope.__alternative = parseFloat((rateService.toFiat(newValue * self.unitToSatoshi, self.alternativeIsoCode)).toFixed(2), 10);
} else {
$scope.__alternative = null;
@ -355,6 +356,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
} else {
amountResult = amount;
}
self.fromInputAmount = true;
self.setForm(null, amountResult, null);
};
@ -569,7 +571,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
form.amount.$setViewValue("" + amount);
form.amount.$isValid = true;
form.amount.$render();
this.lockAmount = true;
if (!this.fromInputAmount)
this.lockAmount = true;
this.fromInputAmount = false;
}
if (comment) {

View File

@ -44,6 +44,28 @@ textarea:focus {
background: transparent;
}
input[type="amount"] {
&[readonly] {
width: 100%;
opacity: 1;
color: #B7C2CD;
margin-bottom: 1.5rem;
height: 35px;
background: transparent;
border: none;
padding-left: 0.1rem;
font-size: 13px;
border-bottom: 1px solid #E9EDF0;
cursor: text;
},
&[disabled] {
background-color: #E4E8EC;
color: #2C3E50;
padding-left: 0.5rem;
opacity: 1;
}
}
input[type="text"] {
&[disabled], &[readonly] {
background-color: #E4E8EC;