- when you add a new ssh key, the title field automatically fills with the email (if is present in the key sting)

This commit is contained in:
Staicu Ionut 2012-03-30 18:30:56 +03:00
parent 1031ca9b68
commit 2b01c65e50

View file

@ -1,3 +1,14 @@
%h3 New key
%hr
= render 'form'
:javascript
$('#key_key').on('keyup', function(){
var title = $('#key_title'),
val = $('#key_key').val(),
key_mail = val.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+|\.[a-zA-Z0-9._-]+)/gi);
if( key_mail && key_mail.length > 0 && title.val() == '' ){
$('#key_title').val( key_mail );
}
});