summaryrefslogtreecommitdiff
path: root/app/views/keys
diff options
context:
space:
mode:
authorStaicu Ionut <github@iamntz.com>2012-03-30 18:30:56 +0300
committerStaicu Ionut <github@iamntz.com>2012-03-30 18:30:56 +0300
commit2b01c65e50234cfa358c14db6e689444095ca9f9 (patch)
treeccc4ce1e0148dc868ff4b93cff2aa501a7bb84fc /app/views/keys
parent1031ca9b685b7717e729ef22c835bb810f19a6f2 (diff)
downloadgitlab-ce-2b01c65e50234cfa358c14db6e689444095ca9f9.tar.gz
- when you add a new ssh key, the title field automatically fills with the email (if is present in the key sting)
Diffstat (limited to 'app/views/keys')
-rw-r--r--app/views/keys/new.html.haml11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/views/keys/new.html.haml b/app/views/keys/new.html.haml
index 743a3173706..277936c6743 100644
--- a/app/views/keys/new.html.haml
+++ b/app/views/keys/new.html.haml
@@ -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 );
+ }
+ }); \ No newline at end of file