mirror of https://github.com/BTCPrivate/copay.git
Added a directive to focus the first input fields
This commit is contained in:
parent
b554c4c7ea
commit
527c3beab1
|
@ -112,20 +112,19 @@ angular.module('copayApp.directives')
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
.directive('walletSecret', function() {
|
.directive('walletSecret', function() {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
link: function(scope, elem, attrs, ctrl) {
|
link: function(scope, elem, attrs, ctrl) {
|
||||||
var validator = function(value) {
|
var validator = function(value) {
|
||||||
var a = new Address(value);
|
var a = new Address(value);
|
||||||
ctrl.$setValidity('walletSecret', !a.isValid() && Boolean(copay.Wallet.decodeSecret(value)));
|
ctrl.$setValidity('walletSecret', !a.isValid() && Boolean(copay.Wallet.decodeSecret(value)));
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
ctrl.$parsers.unshift(validator);
|
ctrl.$parsers.unshift(validator);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
)
|
|
||||||
.directive('loading', function() {
|
.directive('loading', function() {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
|
@ -270,6 +269,16 @@ angular.module('copayApp.directives')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
.directive('autoFocus', function($timeout) {
|
||||||
|
return {
|
||||||
|
restrict: 'AC',
|
||||||
|
link: function(_scope, _element) {
|
||||||
|
$timeout(function() {
|
||||||
|
_element[0].focus();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
.directive('match', function() {
|
.directive('match', function() {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<label><span translate>Wallet name</span>
|
<label><span translate>Wallet name</span>
|
||||||
<input type="text" placeholder="{{'Family vacation funds'|translate}}" class="form-control" ng-model="walletName">
|
<input type="text" placeholder="{{'Family vacation funds'|translate}}" class="form-control" ng-model="walletName" auto-focus>
|
||||||
</label>
|
</label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-6 medium-6 columns">
|
<div class="large-6 medium-6 columns">
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<span class="icon-input right" ng-show="!profileForm.email.$invalid &&
|
<span class="icon-input right" ng-show="!profileForm.email.$invalid &&
|
||||||
!profileForm.email.$pristine || error"><i class="fi-check"></i></span>
|
!profileForm.email.$pristine || error"><i class="fi-check"></i></span>
|
||||||
<input type="email" ng-model="email" class="form-control fi-email"
|
<input type="email" ng-model="email" class="form-control fi-email"
|
||||||
name="email" placeholder="Email" required>
|
name="email" placeholder="Email" required auto-focus>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<input type="email" ng-model="email" class="form-control"
|
<input type="email" ng-model="email" class="form-control"
|
||||||
name="email" placeholder="Email" required>
|
name="email" placeholder="Email" required auto-focus>
|
||||||
<input type="password" ng-model="password" class="form-control"
|
<input type="password" ng-model="password" class="form-control"
|
||||||
name="password" placeholder="Password" required>
|
name="password" placeholder="Password" required>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="pr">
|
<div class="pr">
|
||||||
<input id="connectionId" type="text" class="columns" placeholder="{{'Paste wallet secret here'|translate}}" name="connectionId" ng-model="connectionId" wallet-secret required>
|
<input id="connectionId" type="text" class="columns" placeholder="{{'Paste wallet secret here'|translate}}" name="connectionId" ng-model="connectionId" wallet-secret required auto-focus>
|
||||||
<div ng-hide="showScanner || disableScanner">
|
<div ng-hide="showScanner || disableScanner">
|
||||||
<a class="postfix button black" ng-click="openScanner()"><i class="fi-camera"> </i></a>
|
<a class="postfix button black" ng-click="openScanner()"><i class="fi-camera"> </i></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
<div class="pr">
|
<div class="pr">
|
||||||
<input class="columns" type="text" id="address" name="address" ng-disabled="loading || !!$root.merchant"
|
<input class="columns" type="text" id="address" name="address" ng-disabled="loading || !!$root.merchant"
|
||||||
placeholder="{{'Bitcoin address'|translate}}" ng-model="address" ng-change="onChanged()" valid-address required>
|
placeholder="{{'Bitcoin address'|translate}}" ng-model="address" ng-change="onChanged()" valid-address required auto-focus>
|
||||||
<div ng-hide="showScanner || disableScanner">
|
<div ng-hide="showScanner || disableScanner">
|
||||||
<button class="postfix button black" ng-click="openScanner()"><i class="fi-camera size-24"></i></button>
|
<button class="postfix button black" ng-click="openScanner()"><i class="fi-camera size-24"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue