Commit 2b01c65e50234cfa358c14db6e689444095ca9f9

Authored by Staicu Ionut
1 parent 1031ca9b

- when you add a new ssh key, the title field automatically fills with the email…

… (if is present in the key sting)
Showing 1 changed file with 11 additions and 0 deletions   Show diff stats
app/views/keys/new.html.haml
1 1 %h3 New key
2 2 %hr
3 3 = render 'form'
  4 +
  5 +:javascript
  6 + $('#key_key').on('keyup', function(){
  7 + var title = $('#key_title'),
  8 + val = $('#key_key').val(),
  9 + key_mail = val.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+|\.[a-zA-Z0-9._-]+)/gi);
  10 +
  11 + if( key_mail && key_mail.length > 0 && title.val() == '' ){
  12 + $('#key_title').val( key_mail );
  13 + }
  14 + });
4 15 \ No newline at end of file
... ...