mirror of https://github.com/BTCPrivate/copay.git
Allow only dots to separate decimals
This commit is contained in:
parent
a0acf849ed
commit
cebd8fe06e
|
@ -53,9 +53,9 @@
|
||||||
<span translate>Amount</span>
|
<span translate>Amount</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" id="amount" name="amount" ng-attr-placeholder="{{'Amount'|translate}}"
|
<input type="number" id="amount" name="amount" ng-attr-placeholder="{{'Amount'|translate}}"
|
||||||
ng-model="_customAmount" valid-amount required autocomplete="off" pattern="[0-9]+([\.,][0-9]+)*">
|
ng-model="_customAmount" valid-amount required autocomplete="off">
|
||||||
<input type="text" id="alternative" name="alternative" ng-model="_customAlternative" style="display:none">
|
<input type="number" id="alternative" name="alternative" ng-model="_customAlternative" style="display:none">
|
||||||
<a class="postfix" ng-click="toggleAlternative()">{{unitName}}</a>
|
<a class="postfix" ng-click="toggleAlternative()">{{unitName}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,9 +63,9 @@
|
||||||
<label for="alternative"><span translate>Amount in</span> {{ alternativeName }}
|
<label for="alternative"><span translate>Amount in</span> {{ alternativeName }}
|
||||||
</label>
|
</label>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" id="alternative" name="alternative" ng-attr-placeholder="{{'Amount'|translate}}"
|
<input type="number" id="alternative" name="alternative" ng-attr-placeholder="{{'Amount'|translate}}"
|
||||||
ng-model="_customAlternative" valid-alternative required autocomplete="off" pattern="[0-9]+([\.,][0-9]+)*" required>
|
ng-model="_customAlternative" required autocomplete="off" required>
|
||||||
<input type="text" id="amount" name="amount" ng-model="_customAmount" style="display:none">
|
<input type="number" id="amount" name="amount" ng-model="_customAmount" style="display:none">
|
||||||
<a class="postfix" ng-click="toggleAlternative()"> {{ alternativeIsoCode }}</a>
|
<a class="postfix" ng-click="toggleAlternative()"> {{ alternativeIsoCode }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -388,11 +388,8 @@
|
||||||
<span translate>Amount</span>
|
<span translate>Amount</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" id="amount" ng-disabled="home.blockUx || home.lockAmount" name="amount"
|
<input type="number" id="amount" ng-disabled="home.blockUx || home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount'|translate}}" ng-minlength="0.00000001" ng-maxlength="10000000000" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)">
|
||||||
ng-attr-placeholder="{{'Amount'|translate}}"
|
<input type="number" id="alternative" name="alternative" ng-model="_alternative" style="display:none">
|
||||||
ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')"
|
|
||||||
ng-blur="home.formFocus(false)">
|
|
||||||
<input type="text" id="alternative" name="alternative" ng-model="_alternative" style="display:none">
|
|
||||||
<a class="postfix" ng-click="home.showAlternative()">{{home.unitName}}</a>
|
<a class="postfix" ng-click="home.showAlternative()">{{home.unitName}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -400,11 +397,8 @@
|
||||||
<label for="alternative"><span translate>Amount in</span> {{ home.alternativeName }}
|
<label for="alternative"><span translate>Amount in</span> {{ home.alternativeName }}
|
||||||
</label>
|
</label>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" id="alternative" ng-disabled="home.blockUx || !home.isRateAvailable ||
|
<input type="number" id="alternative" ng-disabled="home.blockUx || !home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount'|translate}}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)">
|
||||||
home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount'|translate}}"
|
<input type="number" id="amount" name="amount" ng-model="_amount" style="display:none">
|
||||||
ng-model="_alternative" valid-alternative required autocomplete="off" ng-focus="home.formFocus('amount')"
|
|
||||||
ng-blur="home.formFocus(false)">
|
|
||||||
<input type="text" id="amount" name="amount" ng-model="_amount" style="display:none">
|
|
||||||
<a class="postfix" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a>
|
<a class="postfix" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -92,7 +92,6 @@ angular.module('copayApp.directives')
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
link: function(scope, element, attrs, ctrl) {
|
link: function(scope, element, attrs, ctrl) {
|
||||||
var val = function(value) {
|
var val = function(value) {
|
||||||
if (value) value = Number(String(value).replace(/,/g, '.'));
|
|
||||||
var settings = configService.getSync().wallet.settings;
|
var settings = configService.getSync().wallet.settings;
|
||||||
var vNum = Number((value * settings.unitToSatoshi).toFixed(0));
|
var vNum = Number((value * settings.unitToSatoshi).toFixed(0));
|
||||||
|
|
||||||
|
@ -120,33 +119,6 @@ angular.module('copayApp.directives')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
.directive('validAlternative', [
|
|
||||||
function() {
|
|
||||||
|
|
||||||
return {
|
|
||||||
require: 'ngModel',
|
|
||||||
link: function(scope, element, attrs, ctrl) {
|
|
||||||
var val = function(value) {
|
|
||||||
if (value) value = Number(String(value).replace(/,/g, '.'));
|
|
||||||
var vNum = Number(value);
|
|
||||||
|
|
||||||
if (typeof value == 'undefined' || value == 0) {
|
|
||||||
ctrl.$pristine = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof vNum == "number" && vNum > 0) {
|
|
||||||
ctrl.$setValidity('validAlternative', true);
|
|
||||||
} else {
|
|
||||||
ctrl.$setValidity('validAlternative', false);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
ctrl.$parsers.unshift(val);
|
|
||||||
ctrl.$formatters.unshift(val);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.directive('walletSecret', function(bitcore) {
|
.directive('walletSecret', function(bitcore) {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
|
|
Loading…
Reference in New Issue